user_groups: Fix live updating user groups UI.

This commit updates code to live update the groups UI if
realm or group level setting to manage groups is changed.

This commit also does some refactoring to better organize the
code in different functions.

And also, the code to hide/disable the UI if the user does not
have permission to manage the group in JS such that the same code
is used for live-updating as well.
This commit is contained in:
Sahil Batra
2024-08-20 16:08:44 +05:30
committed by Tim Abbott
parent 03ec0e1f14
commit d2c7e7e94c
7 changed files with 103 additions and 55 deletions

View File

@@ -201,7 +201,7 @@ export function dispatch_normal_event(event) {
allow_edit_history: noop,
allow_message_editing: noop,
edit_topic_policy: noop,
user_group_edit_policy: noop,
user_group_edit_policy: user_group_edit.update_group_management_ui,
avatar_changes_disabled: settings_account.update_avatar_change_display,
bot_creation_policy: settings_bots.update_bot_permissions_ui,
can_delete_any_message_group: noop,
@@ -930,7 +930,7 @@ export function dispatch_normal_event(event) {
break;
case "update":
user_groups.update(event);
user_group_edit.update_group(event.group_id);
user_group_edit.update_group(event);
break;
default:
blueslip.error("Unexpected event type user_group/" + event.op);