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.

stream_list: Simplify unread count updates when zoomed into topics.

Aman Agrawal4c5ad64a0f41
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index 045ef085e1f..3ae55dfffb9 100644
--- a/web/src/stream_list.ts
+++ b/web/src/stream_list.ts
@@ -904,14 +904,12 @@ function set_stream_unread_count(
stream_has_any_unmuted_unread_mention: boolean,
stream_has_only_muted_unread_mentions: boolean,
): void {
- // Update the unread count for the regular stream list, even if we're
- // currently zoomed in, so that it has the correct number when we zoom
- // out.
- const $stream_li = get_stream_li(stream_id, false);
+ const $stream_li = get_stream_li(stream_id);
if (!$stream_li) {
- // This can happen for legitimate reasons, but we warn
- // just in case.
- blueslip.warn("stream id no longer in sidebar: " + stream_id);
+ // When zoomed into a channel's topic list, only the
+ // zoomed-in channel has a row. The regular sidebar
+ // counts will be refreshed via `update_dom_with_unread_counts`
+ // called at the end of `build_stream_list` on zoom out.
return;
}
update_count_in_dom(
@@ -921,23 +919,6 @@ function set_stream_unread_count(
stream_has_any_unmuted_unread_mention,
stream_has_only_muted_unread_mentions,
);
-
- if (zoomed_in) {
- const $stream_li = get_stream_li(stream_id);
- if (!$stream_li) {
- // When zoomed in, only the zoomed-in stream has a
- // row in the zoomed view, so this is expected for
- // all other streams.
- return;
- }
- update_count_in_dom(
- $stream_li,
- count,
- stream_has_any_unread_mention_messages,
- stream_has_any_unmuted_unread_mention,
- stream_has_only_muted_unread_mentions,
- );
- }
}
export let update_streams_sidebar = (force_rerender = false): void => {