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.

streams_list: Don't zoom out user when stream list rearranges.

Aman Agrawal64584557b296
diff --git a/web/src/stream_list.js b/web/src/stream_list.js
index 1e1dc01258a..b0a183c2544 100644
--- a/web/src/stream_list.js
+++ b/web/src/stream_list.js
@@ -409,6 +409,18 @@ function set_stream_unread_count(stream_id, count, stream_has_any_unread_mention
}
export function update_streams_sidebar(force_rerender) {
+ if (!force_rerender && topic_zoom.is_zoomed_in()) {
+ // We do our best to update topics that are displayed
+ // in case user zoomed in. Streams list will be updated,
+ // once the user zooms out. This avoids user being zoomed out
+ // when a new message causes streams to re-arrange.
+ const filter = narrow_state.filter();
+ update_stream_sidebar_for_narrow(filter);
+ topic_zoom.set_pending_stream_list_rerender(true);
+ return;
+ }
+ topic_zoom.set_pending_stream_list_rerender(false);
+
build_stream_list(force_rerender);
stream_cursor.redraw();
diff --git a/web/src/topic_zoom.js b/web/src/topic_zoom.js
index 375dc48089c..f87d3332654 100644
--- a/web/src/topic_zoom.js
+++ b/web/src/topic_zoom.js
@@ -4,6 +4,7 @@ import * as popovers from "./popovers";
import * as stream_list from "./stream_list";
import * as topic_list from "./topic_list";
+let pending_stream_list_rerender = false;
let zoomed_in = false;
export function is_zoomed_in() {
@@ -22,7 +23,14 @@ function zoom_in() {
zoomed_in = true;
}
+export function set_pending_stream_list_rerender(value) {
+ pending_stream_list_rerender = value;
+}
+
export function zoom_out() {
+ if (pending_stream_list_rerender) {
+ stream_list.update_streams_sidebar(true);
+ }
const $stream_li = topic_list.get_stream_li();
popovers.hide_all_except_sidebars();