diff --git a/components/app.js b/components/app.js index 2ef8cb9..d26ba94 100644 --- a/components/app.js +++ b/components/app.js @@ -1018,12 +1018,8 @@ export default class App extends Component { break; } let readReceipt = { time: bound.replace("timestamp=", "") }; - let updated = this.bufferStore.put({ - name: target, - server: client.params, - receipts: { [ReceiptType.READ]: readReceipt }, - }); - if (!updated) { + let stored = this.bufferStore.get({ name: target, server: client.params }); + if (isReceiptBefore(readReceipt, getReceipt(stored, ReceiptType.READ))) { break; } for (let notif of this.messageNotifications) { @@ -1054,6 +1050,13 @@ export default class App extends Component { unread = Unread.MESSAGE; } + this.bufferStore.put({ + name: target, + server: client.params, + unread, + receipts: { [ReceiptType.READ]: readReceipt }, + }); + return { unread }; }); break;