From 3f9a404fb4b8263b59228e38cf754ab81445de7d Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Wed, 16 Jun 2021 02:29:08 +0000 Subject: [PATCH] stream_create: Use `switch` instead of multiple `else-if`. This change was forced by our linter in the previous commit. --- static/js/stream_create.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/static/js/stream_create.js b/static/js/stream_create.js index 7f1102bafb..477ccece6e 100644 --- a/static/js/stream_create.js +++ b/static/js/stream_create.js @@ -172,15 +172,23 @@ function create_stream() { let history_public_to_subscribers; const privacy_setting = $("#stream_creation_form input[name=privacy]:checked").val(); - if (privacy_setting === "invite-only") { - invite_only = true; - history_public_to_subscribers = false; - } else if (privacy_setting === "invite-only-public-history") { - invite_only = true; - history_public_to_subscribers = true; - } else { - invite_only = false; - history_public_to_subscribers = true; + switch (privacy_setting) { + case "invite-only": { + invite_only = true; + history_public_to_subscribers = false; + + break; + } + case "invite-only-public-history": { + invite_only = true; + history_public_to_subscribers = true; + + break; + } + default: { + invite_only = false; + history_public_to_subscribers = true; + } } data.invite_only = JSON.stringify(invite_only); data.history_public_to_subscribers = JSON.stringify(history_public_to_subscribers);