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.

channel_folders: Fix unread counts for show_channel_folders option.

Evy Kassirera8493e71aa2d
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index 7816102db38..0fca0a3419e 100644
--- a/web/src/stream_list.ts
+++ b/web/src/stream_list.ts
@@ -819,7 +819,7 @@ export let update_dom_with_unread_counts = function (counts: FullUnreadCountsDat
if (sub.pin_to_top) {
pinned_unread_counts.unmuted += stream_count_info.unmuted_count;
pinned_unread_counts.muted += stream_count_info.muted_count;
- } else if (sub.folder_id !== null) {
+ } else if (sub.folder_id !== null && user_settings.web_left_sidebar_show_channel_folders) {
if (!folder_unread_counts.has(sub.folder_id)) {
folder_unread_counts.set(sub.folder_id, {
unmuted: 0,
@@ -894,25 +894,27 @@ export let update_dom_with_unread_counts = function (counts: FullUnreadCountsDat
normal_section_unread_counts.muted_channel_muted,
);
- for (const folder_id of channel_folders.get_all_folder_ids()) {
- const unread_counts = folder_unread_counts.get(folder_id) ?? {
- unmuted: 0,
- muted: 0,
- inactive_unmuted: 0,
- inactive_muted: 0,
- muted_channel_unmuted: 0,
- muted_channel_muted: 0,
- };
- update_section_unread_count(
- $(`#stream-list-${folder_id}-container .stream-list-subsection-header`),
- unread_counts.unmuted,
- unread_counts.muted,
- );
- update_section_unread_count(
- $(`#stream-list-${folder_id}-container .show-inactive-or-muted-channels`),
- unread_counts.inactive_unmuted + unread_counts.muted_channel_unmuted,
- unread_counts.inactive_muted + unread_counts.muted_channel_muted,
- );
+ if (user_settings.web_left_sidebar_show_channel_folders) {
+ for (const folder_id of channel_folders.get_all_folder_ids()) {
+ const unread_counts = folder_unread_counts.get(folder_id) ?? {
+ unmuted: 0,
+ muted: 0,
+ inactive_unmuted: 0,
+ inactive_muted: 0,
+ muted_channel_unmuted: 0,
+ muted_channel_muted: 0,
+ };
+ update_section_unread_count(
+ $(`#stream-list-${folder_id}-container .stream-list-subsection-header`),
+ unread_counts.unmuted,
+ unread_counts.muted,
+ );
+ update_section_unread_count(
+ $(`#stream-list-${folder_id}-container .show-inactive-or-muted-channels`),
+ unread_counts.inactive_unmuted + unread_counts.muted_channel_unmuted,
+ unread_counts.inactive_muted + unread_counts.muted_channel_muted,
+ );
+ }
}
};