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_list: Fix selecting the first message when previously empty.

Tim Abbott8f1c3a0fa1e8
diff --git a/web/src/message_list.js b/web/src/message_list.js
index 854ce65426e..01ff31956a1 100644
--- a/web/src/message_list.js
+++ b/web/src/message_list.js
@@ -124,8 +124,12 @@ export class MessageList {
}
if (this.narrowed && !this.empty() && this.selected_id() === -1) {
- // And also select the newly arrived message.
- this.select_id(this.selected_id(), {then_scroll: true, use_closest: true});
+ // The message list was previously empty, but now isn't
+ // due to adding these messages, and we need to select a
+ // message. Regardless of whether the messages are new or
+ // old, we want to select a message as though we just
+ // entered this view.
+ this.select_id(this.first_unread_message_id(), {then_scroll: true, use_closest: true});
}
return render_info;