stream_create: Use `switch` instead of multiple `else-if`.

This change was forced by our linter in the previous commit.
This commit is contained in:
Aman Agrawal 2021-06-16 02:29:08 +00:00 committed by Tim Abbott
parent 9d291c9d3f
commit 3f9a404fb4
1 changed files with 17 additions and 9 deletions

View File

@ -172,16 +172,24 @@ function create_stream() {
let history_public_to_subscribers; let history_public_to_subscribers;
const privacy_setting = $("#stream_creation_form input[name=privacy]:checked").val(); const privacy_setting = $("#stream_creation_form input[name=privacy]:checked").val();
if (privacy_setting === "invite-only") { switch (privacy_setting) {
case "invite-only": {
invite_only = true; invite_only = true;
history_public_to_subscribers = false; history_public_to_subscribers = false;
} else if (privacy_setting === "invite-only-public-history") {
break;
}
case "invite-only-public-history": {
invite_only = true; invite_only = true;
history_public_to_subscribers = true; history_public_to_subscribers = true;
} else {
break;
}
default: {
invite_only = false; invite_only = false;
history_public_to_subscribers = true; history_public_to_subscribers = true;
} }
}
data.invite_only = JSON.stringify(invite_only); data.invite_only = JSON.stringify(invite_only);
data.history_public_to_subscribers = JSON.stringify(history_public_to_subscribers); data.history_public_to_subscribers = JSON.stringify(history_public_to_subscribers);