Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
left_sidebar: Fully rerender stream list when count display policy changes.
Evy Kassirer033ef953db5b
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.jsindex 4fbc7627321..89bb70abe16 100644--- a/web/src/server_events_dispatch.js+++ b/web/src/server_events_dispatch.js@@ -957,7 +957,7 @@ export function dispatch_normal_event(event) {}}if (event.property === "web_stream_unreads_count_display_policy") {- stream_list.update_dom_unread_counts_visibility();+ stream_list.build_stream_list(true);}if (event.property === "user_list_style") {settings_preferences.report_user_list_style_change(diff --git a/web/src/stream_list.ts b/web/src/stream_list.tsindex acbb9d1fb67..66aaeea1c6e 100644--- a/web/src/stream_list.ts+++ b/web/src/stream_list.ts@@ -685,25 +685,6 @@ function toggle_hide_unread_counts($subscription_block.toggleClass("hide_unread_counts", hide_count);}-export function update_dom_unread_counts_visibility(): void {- // TODO: It's not obviously why this function exists; can't we- // just do a full left sidebar rebuild?- for (const stream of stream_sidebar.rows.values()) {- const $subscription_block = stream.get_li().find(".subscription_block");-- const is_muted = stream_data.is_muted(stream.sub.stream_id);- // Technically, we just need to know if there's at least one- // unmuted unread here, so this could be optimized by using a- // faster `unread.ts` API optimized to compute just the set of- // channels with at least one unmuted unread.- //- // That optimization is inessential as long as this function- // is only called when changing a global personal setting.- const stream_counts = unread.unread_count_info_for_stream(stream.sub.stream_id);- toggle_hide_unread_counts($subscription_block, is_muted, stream_counts.unmuted_count);- }-}-export function rename_stream(sub: StreamSubscription): void {// The sub object is expected to already have the updated namebuild_stream_sidebar_row(sub);diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjsindex 53584a686e9..04f588a67ee 100644--- a/web/tests/dispatch.test.cjs+++ b/web/tests/dispatch.test.cjs@@ -1286,7 +1286,7 @@ run_test("user_settings", ({override}) => {{const stub = make_stub();event = event_fixtures.user_settings__web_stream_unreads_count_display_policy;- override(stream_list, "update_dom_unread_counts_visibility", stub.f);+ override(stream_list, "build_stream_list", stub.f);override(user_settings, "web_stream_unreads_count_display_policy", 1);dispatch(event);assert.equal(stub.num_calls, 1);