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_edit: Use `switch` instead of multiple `else-if`.

Aman Agrawalc6db2a330b77
diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js
index b0a210189d2..34f8cb7fb39 100644
--- a/static/js/stream_edit.js
+++ b/static/js/stream_edit.js
@@ -665,15 +665,23 @@ function change_stream_privacy(e) {
let invite_only;
let history_public_to_subscribers;
- if (privacy_setting === stream_data.stream_privacy_policy_values.public.code) {
- invite_only = false;
- history_public_to_subscribers = true;
- } else if (privacy_setting === stream_data.stream_privacy_policy_values.private.code) {
- invite_only = true;
- history_public_to_subscribers = false;
- } else {
- invite_only = true;
- history_public_to_subscribers = true;
+ switch (privacy_setting) {
+ case stream_data.stream_privacy_policy_values.public.code: {
+ invite_only = false;
+ history_public_to_subscribers = true;
+
+ break;
+ }
+ case stream_data.stream_privacy_policy_values.private.code: {
+ invite_only = true;
+ history_public_to_subscribers = false;
+
+ break;
+ }
+ default: {
+ invite_only = true;
+ history_public_to_subscribers = true;
+ }
}
if (