diff --git a/web/src/message_list.js b/web/src/message_list.js index 2f5fd55b8e..25f6a3b63e 100644 --- a/web/src/message_list.js +++ b/web/src/message_list.js @@ -82,6 +82,10 @@ export class MessageList { return this; } + is_current_message_list() { + return this.view.is_current_message_list(); + } + prevent_reading() { this.reading_prevented = true; } @@ -117,14 +121,14 @@ export class MessageList { render_info = this.append_to_view(bottom_messages, opts); } - if (!this.visibly_empty()) { + if (!this.visibly_empty() && this.is_current_message_list()) { // If adding some new messages to the message tables caused // our current narrow to no longer be empty, hide the empty // feed placeholder text. narrow_banner.hide_empty_narrow_message(); } - if (!this.visibly_empty() && this.selected_id() === -1) { + if (!this.visibly_empty() && this.selected_id() === -1 && this.is_current_message_list()) { // 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 diff --git a/web/src/message_list_view.js b/web/src/message_list_view.js index 0f026534bb..591405c8c6 100644 --- a/web/src/message_list_view.js +++ b/web/src/message_list_view.js @@ -380,6 +380,10 @@ export class MessageListView { message_container.modified = true; } + is_current_message_list() { + return this.list === message_lists.current; + } + set_calculated_message_container_variables(message_container, is_revealed) { set_timestr(message_container); diff --git a/web/tests/compose_closed_ui.test.js b/web/tests/compose_closed_ui.test.js index e43a8b97ce..bd94801879 100644 --- a/web/tests/compose_closed_ui.test.js +++ b/web/tests/compose_closed_ui.test.js @@ -15,6 +15,7 @@ function MessageListView() { maybe_rerender: noop, append: noop, prepend: noop, + is_current_message_list: () => true, }; } mock_esm("../src/message_list_view", { diff --git a/web/tests/message_list.test.js b/web/tests/message_list.test.js index df7d26592e..6b754001bc 100644 --- a/web/tests/message_list.test.js +++ b/web/tests/message_list.test.js @@ -33,6 +33,7 @@ function MessageListView() { append: noop, prepend: noop, clear_rendering_state: noop, + is_current_message_list: () => true, }; } mock_esm("../src/message_list_view", {