Early read receipts should start expiration timers

Check for early read receipts for an incoming messages *after*
processing the expireTimer on that message. Then we can set
expirationStartTime appropriately if an early receipt is found.

Closes #950

// FREEBIE
This commit is contained in:
lilia 2017-05-09 18:37:20 -07:00 committed by Lilia
parent 0496518af4
commit 8bd7280673

View file

@ -394,14 +394,6 @@
});
}
attributes.active_at = now;
if (type === 'incoming') {
// experimental
if (Whisper.ReadReceipts.forMessage(message) || message.isExpirationTimerUpdate()) {
message.unset('unread');
} else {
attributes.unreadCount = conversation.get('unreadCount') + 1;
}
}
conversation.set(attributes);
if (message.isExpirationTimerUpdate()) {
@ -428,6 +420,19 @@
message.get('received_at'));
}
}
if (type === 'incoming') {
var readReceipt = Whisper.ReadReceipts.forMessage(message);
if (readReceipt) {
if (message.get('expireTimer') && !message.get('expirationStartTimestamp')) {
message.set('expirationStartTimestamp', readReceipt.get('read_at'));
}
}
if (readReceipt || message.isExpirationTimerUpdate()) {
message.unset('unread');
} else {
conversation.set('unreadCount', conversation.get('unreadCount') + 1);
}
}
var conversation_timestamp = conversation.get('timestamp');
if (!conversation_timestamp || message.get('sent_at') > conversation_timestamp) {