Refactor read state tracking

Adds support for handling early arriving read receipts.

// FREEBIE
This commit is contained in:
lilia 2016-04-11 15:11:20 -07:00
parent d1e9534542
commit 0cd7f84a05
4 changed files with 55 additions and 25 deletions

View file

@ -326,7 +326,12 @@
}
attributes.active_at = now;
if (type === 'incoming') {
attributes.unreadCount = conversation.get('unreadCount') + 1;
// experimental
if (Whisper.ReadReceipts.forMessage(message)) {
message.unset('unread');
} else {
attributes.unreadCount = conversation.get('unreadCount') + 1;
}
}
conversation.set(attributes);