invites: Live update option to create new invitations.

Earlier option to create new invitations in right_sidebar,
gear_menu and invitations panel does not get live update
when the setting `who can invite others to realm` is changed.

This commit make changes to do live update.
This commit is contained in:
Ujjawal Modi
2023-06-13 13:17:53 +05:30
committed by Tim Abbott
parent f67cef8885
commit 77c67464ba
7 changed files with 33 additions and 8 deletions

View File

@@ -189,13 +189,21 @@ function initialize_left_sidebar() {
$("#left-sidebar-container").html(rendered_sidebar);
}
export function update_invite_user_option() {
if (!settings_data.user_can_invite_others_to_realm()) {
$("#right-sidebar .invite-user-link").hide();
} else {
$("#right-sidebar .invite-user-link").show();
}
}
function initialize_right_sidebar() {
const rendered_sidebar = render_right_sidebar({
can_invite_others_to_realm: settings_data.user_can_invite_others_to_realm(),
realm_rendered_description: page_params.realm_rendered_description,
});
$("#right-sidebar-container").html(rendered_sidebar);
update_invite_user_option();
if (page_params.is_spectator) {
rendered_markdown.update_elements(
$(".right-sidebar .realm-description .rendered_markdown"),