Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

message_scroll: Fix last message not marked as read on `end` keypress.

Aman Agrawal3ff6a89fe6b2
diff --git a/web/src/message_scroll.js b/web/src/message_scroll.js
index 54a585390bd..dba55a6565c 100644
--- a/web/src/message_scroll.js
+++ b/web/src/message_scroll.js
@@ -163,12 +163,13 @@ export function initialize() {
}
const messages = event.msg_list.message_range(event.previously_selected_id, event.id);
- // If the user just arrived at the message `event.id`, we don't mark it as read.
+ // If the user just arrived at the message `event.id`, we don't mark it as read
+ // unless it is the last message in the list.
// We only mark messages as read when the pointer moves past the message.
// This is likely the last message in the list. So, we loop through the messages
// in reverse order to find the message.
for (let i = messages.length - 1; i >= 0; i -= 1) {
- if (messages[i].id === event.id) {
+ if (messages[i].id === event.id && event.id !== event.msg_list.last()?.id) {
delete messages[i];
break;
}