Extract unread_ops.process_read_messages_event().

The new method borrows some code from the event loop
and unread_ops.mark_messages_as_read, and it is now
flexible about message_ids being marked as unread
even when there is no corresponding message in the
message store.  For that scenario we still want to
update our data structures, which wasn't happening
before this change.  (Generally, this was a non-issue
up until now, but it will become a bigger issue when
we start loading unread message ids from the server.)
This commit is contained in:
Steve Howell
2017-08-02 18:28:16 -04:00
committed by Tim Abbott
parent 00a3f6b5f2
commit 241f095213
3 changed files with 44 additions and 12 deletions

View File

@@ -820,13 +820,12 @@ with_overrides(function (override) {
with_overrides(function (override) {
// update_message_flags__read
var event = event_fixtures.update_message_flags__read;
override('unread_ops.mark_messages_as_read', noop);
global.with_stub(function (stub) {
override('message_store.get', stub.f);
override('unread_ops.process_read_messages_event', stub.f);
dispatch(event);
var args = stub.get_args('message_id');
assert_same(args.message_id, 999);
var args = stub.get_args('message_ids');
assert_same(args.message_ids, [999]);
});
});