components/app: stop updating prevReadReceipt on READ message

prevReadReceipt is used for the unread marker. Let's not update it
before the user switches the current buffer.
This commit is contained in:
Simon Ser 2022-02-11 21:09:11 +01:00
parent 6a9a8e88f1
commit dc398baa3b

View file

@ -1031,11 +1031,14 @@ export default class App extends Component {
break;
}
let readReceipt = { time: bound.replace("timestamp=", "") };
this.bufferStore.put({
let updated = this.bufferStore.put({
name: target,
server: client.params,
receipts: { [ReceiptType.READ]: readReceipt },
});
if (!updated) {
break;
}
for (let notif of this.messageNotifications) {
if (client.cm(notif.data.bufferName) !== client.cm(target)) {
continue;
@ -1045,10 +1048,6 @@ export default class App extends Component {
}
}
this.setBufferState({ server: serverID, name: target }, (buf) => {
if (buf.prevReadReceipt && buf.prevReadReceipt.time >= readReceipt.time) {
return;
}
// Re-compute unread status
let unread = Unread.NONE;
for (let i = buf.messages.length - 1; i >= 0; i--) {
@ -1068,7 +1067,7 @@ export default class App extends Component {
unread = Unread.MESSAGE;
}
return { prevReadReceipt: readReceipt, unread };
return { unread };
});
break;
default: