Don't drop unread marker in addMessage

Closes: https://todo.sr.ht/~emersion/gamja/76
This commit is contained in:
Simon Ser 2021-08-24 13:59:33 +02:00
parent b14cddc0d0
commit 6e59a77672
2 changed files with 2 additions and 3 deletions

View file

@ -467,19 +467,17 @@ export default class App extends Component {
this.setBufferState(bufID, (buf) => {
// TODO: set unread if scrolled up
let unread = buf.unread;
let lastReadReceipt = buf.lastReadReceipt;
if (this.state.activeBuffer !== buf.id) {
unread = Unread.union(unread, msgUnread);
} else {
this.setReceipt(bufName, ReceiptType.READ, msg);
lastReadReceipt = this.getReceipt(bufName, ReceiptType.READ);
}
this.bufferStore.put({
name: buf.name,
server: client.params,
unread,
});
return { unread, lastReadReceipt };
return { unread };
});
}

View file

@ -275,6 +275,7 @@ export const State = {
offline: false, // if nick
messages: [],
unread: Unread.NONE,
lastReadReceipt: null,
});
bufferList = bufferList.sort(compareBuffers);
let buffers = new Map(bufferList.map((buf) => [buf.id, buf]));