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-settings: Fix right panel resetting on filter change.

Pratik Chandaa504753961a6
diff --git a/web/src/stream_settings_ui.js b/web/src/stream_settings_ui.js
index 16ea2a198f1..2f306939937 100644
--- a/web/src/stream_settings_ui.js
+++ b/web/src/stream_settings_ui.js
@@ -469,10 +469,6 @@ export function redraw_left_panel(left_panel_params = get_left_panel_params()) {
.get_content_element($("#streams_overlay_container .streams-list"))
.append(widgets.get(stream_id));
}
-
- if ($(".stream-row.active").hasClass("notdisplayed")) {
- stream_edit.empty_right_panel();
- }
update_empty_left_panel_message();
// return this for test convenience
@@ -509,6 +505,9 @@ export function switch_stream_tab(tab_name) {
}
redraw_left_panel();
+ if ($(".stream-row.active").hasClass("notdisplayed")) {
+ stream_edit.empty_right_panel();
+ }
stream_edit.setup_subscriptions_tab_hash(tab_name);
}
diff --git a/web/tests/stream_settings_ui.test.js b/web/tests/stream_settings_ui.test.js
index 8417c168d43..2c7c4e7a69f 100644
--- a/web/tests/stream_settings_ui.test.js
+++ b/web/tests/stream_settings_ui.test.js
@@ -16,6 +16,10 @@ mock_esm("../src/hash_util", {
by_stream_url() {},
});
+mock_esm("../src/browser_history", {
+ update() {},
+});
+
mock_esm("../src/hash_parser", {
get_current_hash_section: () => denmark_stream_id,
});
@@ -212,6 +216,9 @@ run_test("redraw_left_panel", ({mock_template}) => {
};
test_filter({input: "d", subscribed_only: true}, [poland]);
+ assert.ok($(".stream-row-denmark").hasClass("active"));
+
+ stream_settings_ui.switch_stream_tab("subscribed");
assert.ok(!$(".stream-row-denmark").hasClass("active"));
assert.ok(!$(".right .settings").visible());
assert.ok($(".nothing-selected").visible());