When marking message read, ensure that peers have same read_at

When we mark a message as read, we go to the database to ensure that
older messages in this conversation are marked read as well. That
optimization was missing the read_at value provided to the starting
message, so now it is piped along to all of them.
This commit is contained in:
Scott Nonnenberg 2018-05-24 18:54:06 -07:00
parent 9400d1a538
commit 8c85f6e3a6
3 changed files with 15 additions and 10 deletions

View file

@ -7,6 +7,7 @@
/* global Signal: false */
/* global textsecure: false */
/* global Whisper: false */
/* global wrapDeferred: false */
/* eslint-disable more/no-then */
@ -798,7 +799,7 @@
})
);
},
markRead(readAt) {
async markRead(readAt) {
this.unset('unread');
if (this.get('expireTimer') && !this.get('expirationStartTimestamp')) {
this.set('expirationStartTimestamp', readAt || Date.now());
@ -808,9 +809,7 @@
messageId: this.id,
})
);
return new Promise((resolve, reject) => {
this.save().then(resolve, reject);
});
return wrapDeferred(this.save());
},
isExpiring() {
return this.get('expireTimer') && this.get('expirationStartTimestamp');