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: Maybe hide topic bracket after updating stream list.

Evy Kassirer2193996882ec
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index ef51855e897..74bfe404f26 100644
--- a/web/src/stream_list.ts
+++ b/web/src/stream_list.ts
@@ -1155,9 +1155,25 @@ export function update_stream_sidebar_for_narrow(filter: Filter): JQuery | undef
update_inbox_channel_view_callback(stream_id);
topic_list.rebuild_left_sidebar($stream_li, stream_id);
topic_list.topic_state_typeahead?.lookup(true);
+
+ // If we're updating a view for a highlighted stream, it's possible
+ // that we now need to hide the topic bracket (e.g. navigating to the
+ // channel view when the channel view is set to be 'list of topics').
+ maybe_hide_topic_bracket(get_section_id_for_stream_li($stream_li));
+
return $stream_li;
}
+export let get_section_id_for_stream_li = function ($stream_li: JQuery): string {
+ return $stream_li.parents(".stream-list-section-container").attr("data-section-id")!;
+};
+
+export function rewire_get_section_id_for_stream_li(
+ value: typeof get_section_id_for_stream_li,
+): void {
+ get_section_id_for_stream_li = value;
+}
+
export function handle_narrow_activated(
filter: Filter,
change_hash: boolean,
diff --git a/web/tests/stream_list.test.cjs b/web/tests/stream_list.test.cjs
index b6830a70198..5bc049d55dc 100644
--- a/web/tests/stream_list.test.cjs
+++ b/web/tests/stream_list.test.cjs
@@ -449,6 +449,8 @@ test_ui("narrowing", ({override_rewire}) => {
override_rewire(stream_list, "scroll_stream_into_view", noop);
override_rewire(stream_list, "update_stream_section_mention_indicators", noop);
override_rewire(stream_list, "update_dom_with_unread_counts", noop);
+ override_rewire(stream_list, "get_section_id_for_stream_li", () => "normal");
+ override_rewire(stream_list, "maybe_hide_topic_bracket", noop);
override_rewire(left_sidebar_navigation_area, "update_dom_with_unread_counts", noop);
override_rewire(stream_list, "set_sections_states", noop);