Skip to content

Commit

Permalink
invite: Fix rendering invite modal for realms without default channels.
Browse files Browse the repository at this point in the history
The default channels checkbox only exists in DOM if there are default
channels in the realm, so we should make sure that we check whether
there are default channels in the realm before accessing the
checkbox element in set_streams_to_join_visibility.
  • Loading branch information
sahil839 authored and timabbott committed May 23, 2024
1 parent e6c074e commit 959c78e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/src/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,11 @@ function set_custom_time_inputs_visibility(): void {
}

function set_streams_to_join_list_visibility(): void {
const default_streams_selected = $<HTMLInputElement>("input#invite_select_default_streams")[0]
.checked;
if (default_streams_selected) {
const realm_has_default_streams = stream_data.get_default_stream_ids().length !== 0;
const hide_streams_list =
realm_has_default_streams &&
$<HTMLInputElement>("input#invite_select_default_streams")[0].checked;
if (hide_streams_list) {
$("#streams_to_add .invite-stream-controls").hide();
$("#invite-stream-checkboxes").hide();
} else {
Expand Down

0 comments on commit 959c78e

Please sign in to comment.