streams: Consider only visible choices while selecting default choice.

We should only consider visible choices while selecting the default
stream-privacy choice in stream creation form. Previously, we were
only checking whether the option is disabled, but this resulted in
a case where no option was selected when the realm-level setting
was set to not allow web-public streams as the choice was only
hidden and not disabled.
This commit is contained in:
Sahil Batra 2021-12-07 12:33:02 +05:30 committed by Tim Abbott
parent 1049867485
commit 265a587470
1 changed files with 2 additions and 2 deletions

View File

@ -338,8 +338,8 @@ export function show_new_stream_modal() {
html_selector: (user) => $(`#${CSS.escape("user_checkbox_" + user.user_id)}`),
});
// Select the first enabled choice for stream privacy.
$("#make-invite-only input:not([disabled]):first").prop("checked", true);
// Select the first visible and enabled choice for stream privacy.
$("#make-invite-only input:visible:not([disabled]):first").prop("checked", true);
// Make the options default to the same each time:
// "announce stream" on.
$("#stream_creation_form .stream-message-retention-days-input").hide();