Conversation.markRead: Remove checks for unread

We will now always attempt to mark things unread if this method. If the
conversation's unreadCount gets out of date, set to zero, we will still
do it. If we go through the motions, and nothing is newly marked read,
we will still set the unreadCount to zero.
This commit is contained in:
Scott Nonnenberg 2017-06-07 12:20:25 -07:00
parent 6fbdd63e7e
commit aeefc530d2

View file

@ -305,7 +305,6 @@
options = options || {};
_.defaults(options, {sendReadReceipts: true});
if (this.get('unreadCount') > 0) {
var conversationId = this.id;
Whisper.Notifications.remove(Whisper.Notifications.where({
conversationId: conversationId
@ -330,17 +329,14 @@
};
}.bind(this));
if (read.length > 0) {
var unreadCount = unreadMessages.length - read.length;
this.save({ unreadCount: unreadCount });
if (options.sendReadReceipts) {
if (read.length && options.sendReadReceipts) {
console.log('Sending', read.length, 'read receipts');
textsecure.messaging.syncReadMessages(read);
}
}
}.bind(this));
}
},
fetchMessages: function() {