From f2c9fd1d7f4a919bebe71f737c1ce87243ea3704 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 12 Feb 2022 10:24:56 +0100 Subject: [PATCH] Update stored unread status on READ message --- components/app.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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;