Mark older messages as read when we get out-of-order read receipt
FREEBIE
This commit is contained in:
parent
aeefc530d2
commit
785b117b86
2 changed files with 16 additions and 10 deletions
|
@ -457,6 +457,10 @@
|
||||||
}
|
}
|
||||||
if (readReceipt || message.isExpirationTimerUpdate()) {
|
if (readReceipt || message.isExpirationTimerUpdate()) {
|
||||||
message.unset('unread');
|
message.unset('unread');
|
||||||
|
// This is primarily to allow the conversation to mark all older messages as
|
||||||
|
// read, as is done when we receive a read receipt for a message we already
|
||||||
|
// know about.
|
||||||
|
Whisper.ReadReceipts.notifyConversation(message);
|
||||||
} else {
|
} else {
|
||||||
conversation.set('unreadCount', conversation.get('unreadCount') + 1);
|
conversation.set('unreadCount', conversation.get('unreadCount') + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,19 +29,21 @@
|
||||||
if (message) {
|
if (message) {
|
||||||
this.remove(receipt);
|
this.remove(receipt);
|
||||||
message.markRead(receipt.get('read_at')).then(function() {
|
message.markRead(receipt.get('read_at')).then(function() {
|
||||||
|
this.notifyConversation(message);
|
||||||
|
}.bind(this));
|
||||||
|
} else {
|
||||||
|
console.log('No message for read receipt');
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
notifyConversation: function(message) {
|
||||||
var conversation = ConversationController.get({
|
var conversation = ConversationController.get({
|
||||||
id: message.get('conversationId')
|
id: message.get('conversationId')
|
||||||
});
|
});
|
||||||
|
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
// notify frontend listeners
|
|
||||||
conversation.onReadMessage(message);
|
conversation.onReadMessage(message);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
} else {
|
|
||||||
console.log('No message for read receipt');
|
|
||||||
}
|
|
||||||
}.bind(this));
|
|
||||||
}
|
|
||||||
}))();
|
}))();
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue