From 8a5e52ed9a63dc35983811ad5ec5b274c9eda616 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 24 Aug 2021 14:01:57 +0200 Subject: [PATCH] Rename buffer lastReadReceipt to prevReadReceipt This field is intentionally behind the latest read receipt. Let's rename it to make that clearer. --- components/app.js | 4 ++-- components/buffer.js | 2 +- state.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/app.js b/components/app.js index 0359ed1..025ca7e 100644 --- a/components/app.js +++ b/components/app.js @@ -305,11 +305,11 @@ export default class App extends Component { return; } - let lastReadReceipt = this.getReceipt(buf.name, ReceiptType.READ); + let prevReadReceipt = this.getReceipt(buf.name, ReceiptType.READ); // TODO: only mark as read if user scrolled at the bottom this.setBufferState(buf.id, { unread: Unread.NONE, - lastReadReceipt, + prevReadReceipt, }); if (this.buffer.current) { diff --git a/components/buffer.js b/components/buffer.js index 501a03a..d5f119e 100644 --- a/components/buffer.js +++ b/components/buffer.js @@ -479,7 +479,7 @@ export default class Buffer extends Component { buf.messages.forEach((msg) => { let sep = []; - if (!hasUnreadSeparator && buf.type != BufferType.SERVER && buf.lastReadReceipt && msg.tags.time > buf.lastReadReceipt.time) { + if (!hasUnreadSeparator && buf.type != BufferType.SERVER && buf.prevReadReceipt && msg.tags.time > buf.prevReadReceipt.time) { sep.push(html`<${UnreadSeparator} key="unread"/>`); hasUnreadSeparator = true; } diff --git a/state.js b/state.js index fd67043..372bcd7 100644 --- a/state.js +++ b/state.js @@ -275,7 +275,7 @@ export const State = { offline: false, // if nick messages: [], unread: Unread.NONE, - lastReadReceipt: null, + prevReadReceipt: null, }); bufferList = bufferList.sort(compareBuffers); let buffers = new Map(bufferList.map((buf) => [buf.id, buf]));