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