Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_edit: Move get_request_data_for_stream_privacy to settings_data.
Anders Kaseorg278bd52b4ed9
diff --git a/web/src/settings_data.ts b/web/src/settings_data.tsindex 2924eb1e005..9084ea56024 100644--- a/web/src/settings_data.ts+++ b/web/src/settings_data.ts@@ -263,3 +263,41 @@ export function bot_type_id_to_string(type_id: number): string | undefined {return bot_type.name;}++/* istanbul ignore next */+export function get_request_data_for_stream_privacy(selected_val: string): {+ is_private: boolean;+ history_public_to_subscribers: boolean;+ is_web_public: boolean;+} {+ switch (selected_val) {+ case settings_config.stream_privacy_policy_values.public.code: {+ return {+ is_private: false,+ history_public_to_subscribers: true,+ is_web_public: false,+ };+ }+ case settings_config.stream_privacy_policy_values.private.code: {+ return {+ is_private: true,+ history_public_to_subscribers: false,+ is_web_public: false,+ };+ }+ case settings_config.stream_privacy_policy_values.web_public.code: {+ return {+ is_private: false,+ history_public_to_subscribers: true,+ is_web_public: true,+ };+ }+ default: {+ return {+ is_private: true,+ history_public_to_subscribers: true,+ is_web_public: false,+ };+ }+ }+}diff --git a/web/src/settings_org.js b/web/src/settings_org.jsindex 5504178fa81..d78f6e33a1a 100644--- a/web/src/settings_org.js+++ b/web/src/settings_org.js@@ -1369,7 +1369,7 @@ export function populate_data_for_request(subsection, for_realm_default_settingsif (property_name === "stream_privacy") {data = {...data,- ...stream_edit.get_request_data_for_stream_privacy(input_value),+ ...settings_data.get_request_data_for_stream_privacy(input_value),};continue;}diff --git a/web/src/stream_edit.js b/web/src/stream_edit.jsindex cdc6335bcd7..62258f9fbad 100644--- a/web/src/stream_edit.js+++ b/web/src/stream_edit.js@@ -339,39 +339,6 @@ export function stream_setting_changed(e, from_notification_settings) {stream_settings_api.set_stream_property(sub, setting, e.target.checked, status_element);}-export function get_request_data_for_stream_privacy(selected_val) {- switch (selected_val) {- case settings_config.stream_privacy_policy_values.public.code: {- return {- is_private: false,- history_public_to_subscribers: true,- is_web_public: false,- };- }- case settings_config.stream_privacy_policy_values.private.code: {- return {- is_private: true,- history_public_to_subscribers: false,- is_web_public: false,- };- }- case settings_config.stream_privacy_policy_values.web_public.code: {- return {- is_private: false,- history_public_to_subscribers: true,- is_web_public: true,- };- }- default: {- return {- is_private: true,- history_public_to_subscribers: true,- is_web_public: false,- };- }- }-}-export function archive_stream(stream_id, $alert_element, $stream_row) {channel.del({url: "/json/streams/" + stream_id,