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: Move and deduplicate reselect_selected_id functions.

Tim Abbott1b18f1fb5de7
diff --git a/static/js/message_list.js b/static/js/message_list.js
index 7570c1ff002..daedcd47060 100644
--- a/static/js/message_list.js
+++ b/static/js/message_list.js
@@ -203,10 +203,6 @@ export class MessageList {
$(document).trigger(new $.Event("message_selected.zulip", opts));
}
- reselect_selected_id() {
- this.select_id(this.data.selected_id(), {from_rendering: true});
- }
-
selected_message() {
return this.get(this.data.selected_id());
}
@@ -326,9 +322,17 @@ export class MessageList {
$row.removeClass("unread");
}
+ reselect_selected_id() {
+ const selected_id = this.data.selected_id();
+
+ if (selected_id !== -1) {
+ this.select_id(this.data.selected_id(), {from_rendering: true});
+ }
+ }
+
rerender_view() {
this.view.rerender_preserving_scrolltop();
- this.redo_selection();
+ this.reselect_selected_id();
}
rerender() {
@@ -349,14 +353,6 @@ export class MessageList {
this.rerender_view();
}
- redo_selection() {
- const selected_id = this.data.selected_id();
-
- if (selected_id !== -1) {
- this.select_id(selected_id);
- }
- }
-
update_muting_and_rerender() {
this.data.update_items_for_muting();
// We need to rerender whether or not the narrow hides muted