Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_overlay: Change the subscribed_only to show_subscribed.
sujal shahd7936fe576ac
diff --git a/web/src/stream_settings_ui.js b/web/src/stream_settings_ui.jsindex adbb2e5f884..d033ec6a477 100644--- a/web/src/stream_settings_ui.js+++ b/web/src/stream_settings_ui.js@@ -348,7 +348,7 @@ export function update_settings_for_unsubscribed(slim_sub) {}function triage_stream(left_panel_params, sub) {- if (left_panel_params.subscribed_only && !sub.subscribed) {+ if (left_panel_params.show_subscribed && !sub.subscribed) {// reject non-subscribed streamsreturn "rejected";}@@ -443,7 +443,7 @@ export function update_empty_left_panel_message() {$(".no-streams-to-show").show();}-// LeftPanelParams { input: String, subscribed_only: Boolean, sort_order: String }+// LeftPanelParams { input: String, show_subscribed: Boolean, sort_order: String }export function redraw_left_panel(left_panel_params = get_left_panel_params()) {// We only get left_panel_params passed in from tests. Real// code calls get_left_panel_params().@@ -507,7 +507,7 @@ export function get_left_panel_params() {const input = $search_box.expectOne().val().trim();const params = {input,- subscribed_only: stream_ui_updates.subscribed_only,+ show_subscribed: stream_ui_updates.show_subscribed,sort_order,};return params;@@ -524,9 +524,9 @@ export function switch_stream_tab(tab_name) {*/if (tab_name === "all-streams") {- stream_ui_updates.set_subscribed_only(false);+ stream_ui_updates.set_show_subscribed(false);} else if (tab_name === "subscribed") {- stream_ui_updates.set_subscribed_only(true);+ stream_ui_updates.set_show_subscribed(true);}redraw_left_panel();@@ -597,7 +597,7 @@ export function setup_page(callback) {// Reset our internal state to reflect that we're initially in// the "Subscribed" tab if we're reopening "Stream settings".- stream_ui_updates.set_subscribed_only(true);+ stream_ui_updates.set_show_subscribed(true);toggler = components.toggle({child_wants_focus: true,values: [diff --git a/web/src/stream_ui_updates.js b/web/src/stream_ui_updates.jsindex 3c7cea18169..e0f1bfb119a 100644--- a/web/src/stream_ui_updates.js+++ b/web/src/stream_ui_updates.js@@ -28,16 +28,16 @@ function settings_button_for_sub(sub) {);}-export let subscribed_only = true;+export let show_subscribed = true;export function is_subscribed_stream_tab_active() {// Returns true if "Subscribed" tab in stream settings is open// otherwise false.- return subscribed_only;+ return show_subscribed;}-export function set_subscribed_only(value) {- subscribed_only = value;+export function set_show_subscribed(value) {+ show_subscribed = value;}export function update_web_public_stream_privacy_option_state($container) {diff --git a/web/tests/stream_settings_ui.test.js b/web/tests/stream_settings_ui.test.jsindex 494b95d46c4..745b65fa1b2 100644--- a/web/tests/stream_settings_ui.test.js+++ b/web/tests/stream_settings_ui.test.js@@ -154,33 +154,33 @@ run_test("redraw_left_panel", ({mock_template}) => {}// Search with single keyword- test_filter({input: "Po", subscribed_only: false}, [poland, pomona]);+ test_filter({input: "Po", show_subscribed: false}, [poland, pomona]);assert.ok(ui_called);// The denmark row is active, even though it's not displayed.assert.ok($denmark_row.hasClass("active"));// Search with multiple keywords- test_filter({input: "Denmark, Pol", subscribed_only: false}, [denmark, poland]);- test_filter({input: "Den, Pol", subscribed_only: false}, [denmark, poland]);+ test_filter({input: "Denmark, Pol", show_subscribed: false}, [denmark, poland]);+ test_filter({input: "Den, Pol", show_subscribed: false}, [denmark, poland]);// Search is case-insensitive- test_filter({input: "po", subscribed_only: false}, [poland, pomona]);+ test_filter({input: "po", show_subscribed: false}, [poland, pomona]);// Search handles unusual characters like C++- test_filter({input: "c++", subscribed_only: false}, [cpp]);+ test_filter({input: "c++", show_subscribed: false}, [cpp]);// Search subscribed streams only- test_filter({input: "d", subscribed_only: true}, [poland]);+ test_filter({input: "d", show_subscribed: true}, [poland]);// Search terms match stream description- test_filter({input: "Co", subscribed_only: false}, [denmark, pomona]);+ test_filter({input: "Co", show_subscribed: false}, [denmark, pomona]);// Search names AND descriptions- test_filter({input: "Mon", subscribed_only: false}, [pomona, poland]);+ test_filter({input: "Mon", show_subscribed: false}, [pomona, poland]);// Explicitly order streams by name- test_filter({input: "", subscribed_only: false, sort_order: "by-stream-name"}, [+ test_filter({input: "", show_subscribed: false, sort_order: "by-stream-name"}, [cpp,denmark,poland,@@ -189,7 +189,7 @@ run_test("redraw_left_panel", ({mock_template}) => {]);// Order streams by subscriber count- test_filter({input: "", subscribed_only: false, sort_order: "by-subscriber-count"}, [+ test_filter({input: "", show_subscribed: false, sort_order: "by-subscriber-count"}, [poland,cpp,zzyzx,@@ -198,7 +198,7 @@ run_test("redraw_left_panel", ({mock_template}) => {]);// Order streams by weekly traffic- test_filter({input: "", subscribed_only: false, sort_order: "by-weekly-traffic"}, [+ test_filter({input: "", show_subscribed: false, sort_order: "by-weekly-traffic"}, [poland,cpp,zzyzx,@@ -207,7 +207,7 @@ run_test("redraw_left_panel", ({mock_template}) => {]);// Sort for subscribed only.- test_filter({input: "", subscribed_only: true, sort_order: "by-subscriber-count"}, [+ test_filter({input: "", show_subscribed: true, sort_order: "by-subscriber-count"}, [poland,cpp,zzyzx,@@ -225,7 +225,7 @@ run_test("redraw_left_panel", ({mock_template}) => {$(".stream-row-denmark").removeClass("active");};- test_filter({input: "d", subscribed_only: true}, [poland]);+ test_filter({input: "d", show_subscribed: true}, [poland]);assert.ok($(".stream-row-denmark").hasClass("active"));stream_settings_ui.switch_stream_tab("subscribed");