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-sort: Simplify topic check for current narrow channel.

Lauryn Menardd1ceb7cc00ca
diff --git a/web/src/stream_list_sort.ts b/web/src/stream_list_sort.ts
index fe79b2fbbd5..277c8032e21 100644
--- a/web/src/stream_list_sort.ts
+++ b/web/src/stream_list_sort.ts
@@ -9,6 +9,7 @@ import * as sub_store from "./sub_store.ts";
import type {StreamSubscription} from "./sub_store.ts";
import * as topic_list_data from "./topic_list_data.ts";
import {user_settings} from "./user_settings.ts";
+import * as user_topics from "./user_topics.ts";
import * as util from "./util.ts";
let first_render_completed = false;
@@ -158,14 +159,16 @@ export function sort_groups(
if (
current_channel_id !== undefined &&
stream_data.is_subscribed(current_channel_id) &&
- !matching_stream_ids.includes(current_channel_id) &&
- // If any of the topics of the channel match the search term, we need to
- // include the channel in the list of streams.
- topic_list_data.get_list_info(current_channel_id, false, (topic_names) =>
- topic_list_data.filter_topics_by_search_term(topic_names, search_term),
- ).items.length > 0
+ !matching_stream_ids.includes(current_channel_id)
) {
- matching_stream_ids.push(current_channel_id);
+ // If any of the unmuted topics of the channel match the search
+ // term, we include the channel in the list of matches.
+ const topics = topic_list_data.get_filtered_topic_names(current_channel_id, (topic_names) =>
+ topic_list_data.filter_topics_by_search_term(topic_names, search_term),
+ );
+ if (topics.some((topic) => !user_topics.is_topic_muted(current_channel_id, topic))) {
+ matching_stream_ids.push(current_channel_id);
+ }
}
// If the channel folder matches the search term, include all channels