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:
parent
0496518af4
commit
8bd7280673
1 changed files with 13 additions and 8 deletions
|
@ -394,14 +394,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
attributes.active_at = now;
|
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);
|
conversation.set(attributes);
|
||||||
|
|
||||||
if (message.isExpirationTimerUpdate()) {
|
if (message.isExpirationTimerUpdate()) {
|
||||||
|
@ -428,6 +420,19 @@
|
||||||
message.get('received_at'));
|
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');
|
var conversation_timestamp = conversation.get('timestamp');
|
||||||
if (!conversation_timestamp || message.get('sent_at') > conversation_timestamp) {
|
if (!conversation_timestamp || message.get('sent_at') > conversation_timestamp) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue