Update stored unread status on READ message

This commit is contained in:
Simon Ser 2022-02-12 10:24:56 +01:00
parent a3eec9a351
commit f2c9fd1d7f

View File

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