message_list: Only update selected id and banner for current list.

This commit is contained in:
Aman Agrawal 2024-04-27 07:57:34 +00:00 committed by Tim Abbott
parent 439091998d
commit 2eb216f1da
4 changed files with 12 additions and 2 deletions

View File

@ -82,6 +82,10 @@ export class MessageList {
return this; return this;
} }
is_current_message_list() {
return this.view.is_current_message_list();
}
prevent_reading() { prevent_reading() {
this.reading_prevented = true; this.reading_prevented = true;
} }
@ -117,14 +121,14 @@ export class MessageList {
render_info = this.append_to_view(bottom_messages, opts); 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 // If adding some new messages to the message tables caused
// our current narrow to no longer be empty, hide the empty // our current narrow to no longer be empty, hide the empty
// feed placeholder text. // feed placeholder text.
narrow_banner.hide_empty_narrow_message(); 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 // The message list was previously empty, but now isn't
// due to adding these messages, and we need to select a // due to adding these messages, and we need to select a
// message. Regardless of whether the messages are new or // message. Regardless of whether the messages are new or

View File

@ -380,6 +380,10 @@ export class MessageListView {
message_container.modified = true; message_container.modified = true;
} }
is_current_message_list() {
return this.list === message_lists.current;
}
set_calculated_message_container_variables(message_container, is_revealed) { set_calculated_message_container_variables(message_container, is_revealed) {
set_timestr(message_container); set_timestr(message_container);

View File

@ -15,6 +15,7 @@ function MessageListView() {
maybe_rerender: noop, maybe_rerender: noop,
append: noop, append: noop,
prepend: noop, prepend: noop,
is_current_message_list: () => true,
}; };
} }
mock_esm("../src/message_list_view", { mock_esm("../src/message_list_view", {

View File

@ -33,6 +33,7 @@ function MessageListView() {
append: noop, append: noop,
prepend: noop, prepend: noop,
clear_rendering_state: noop, clear_rendering_state: noop,
is_current_message_list: () => true,
}; };
} }
mock_esm("../src/message_list_view", { mock_esm("../src/message_list_view", {