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: Refactor and update API to include `rerender_view`.

Ryan Rehmane85bc853d67f
diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.js
index 27e89fe9849..9c5e0335b65 100644
--- a/frontend_tests/node_tests/message_list_data.js
+++ b/frontend_tests/node_tests/message_list_data.js
@@ -87,7 +87,7 @@ run_test("basics", () => {
mld.get(125.01).id = 145;
mld.change_message_id(125.01, 145, {
- re_render: () => {},
+ rerender_view: () => {},
});
assert_contents(mld, [120, 130, 140, 145]);
diff --git a/static/js/message_list.js b/static/js/message_list.js
index 87023de8701..b9f98ffd132 100644
--- a/static/js/message_list.js
+++ b/static/js/message_list.js
@@ -338,6 +338,11 @@ class MessageList {
row.removeClass("unread");
}
+ rerender_view() {
+ this.view.rerender_preserving_scrolltop();
+ this.redo_selection();
+ }
+
rerender() {
// We need to clear the rendering state, rather than just
// doing clear_table, since we want to potentially recollapse
@@ -353,9 +358,7 @@ class MessageList {
narrow.hide_empty_narrow_message();
}
}
-
- this.view.rerender_preserving_scrolltop();
- this.redo_selection();
+ this.rerender_view();
}
redo_selection() {
@@ -414,10 +417,7 @@ class MessageList {
change_message_id(old_id, new_id) {
const opts = {
is_current_list: () => current_msg_list === this,
- re_render: () => {
- this.view.rerender_preserving_scrolltop();
- this.redo_selection();
- },
+ rerender_view: () => this.rerender_view(),
};
this.data.change_message_id(old_id, new_id, opts);
}
diff --git a/static/js/message_list_data.js b/static/js/message_list_data.js
index dcfd01d8484..e24af731831 100644
--- a/static/js/message_list_data.js
+++ b/static/js/message_list_data.js
@@ -551,7 +551,7 @@ class MessageListData {
// whether this deferral is necessary; it was present in
// the original 2013 local echo implementation but we
// don't have records for why we added it then.
- setTimeout(opts.re_render, 0);
+ setTimeout(opts.rerender_view, 0);
}
}