From 8fa225d885396878d7d3ad4904eb3f0a977ec8b4 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Mon, 28 Oct 2024 19:36:21 +0530 Subject: [PATCH] settings: Use new pills UI for group related realm settings. This commit updates the code to use new UI for can_create_groups and can_manage_all_groups settings. --- web/src/settings_components.ts | 10 ++++--- web/src/settings_org.ts | 23 ++++++++++++--- web/src/state_data.ts | 4 +-- web/src/user_events.js | 1 + .../organization_permissions_admin.hbs | 28 ++++++++++++------- 5 files changed, 46 insertions(+), 20 deletions(-) diff --git a/web/src/settings_components.ts b/web/src/settings_components.ts index 97498c6d96..79a684611b 100644 --- a/web/src/settings_components.ts +++ b/web/src/settings_components.ts @@ -480,11 +480,9 @@ const dropdown_widget_map = new Map([ ["can_remove_subscribers_group", null], ["realm_can_access_all_users_group", null], ["realm_can_add_custom_emoji_group", null], - ["realm_can_create_groups", null], ["realm_can_create_web_public_channel_group", null], ["realm_can_delete_any_message_group", null], ["realm_can_delete_own_message_group", null], - ["realm_can_manage_all_groups", null], ["realm_can_move_messages_between_channels_group", null], ["realm_direct_message_initiator_group", null], ["realm_direct_message_permission_group", null], @@ -800,18 +798,18 @@ export function check_realm_settings_property_changed(elem: HTMLElement): boolea case "realm_default_code_block_language": case "realm_can_access_all_users_group": case "realm_can_add_custom_emoji_group": - case "realm_can_create_groups": case "realm_can_create_web_public_channel_group": case "realm_can_delete_any_message_group": case "realm_can_delete_own_message_group": - case "realm_can_manage_all_groups": case "realm_can_move_messages_between_channels_group": case "realm_direct_message_initiator_group": case "realm_direct_message_permission_group": proposed_val = get_dropdown_list_widget_setting_value($elem); break; + case "realm_can_create_groups": case "realm_can_create_public_channel_group": case "realm_can_create_private_channel_group": + case "realm_can_manage_all_groups": case "realm_create_multiuse_invite_group": { const pill_widget = get_group_setting_widget(property_name); assert(pill_widget !== null); @@ -1428,8 +1426,10 @@ export const group_setting_widget_map = new Map - {{> ../dropdown_widget_with_label - widget_name="realm_can_create_groups" - label=(t 'Who can create user groups') - value_type="number" - is_setting_disabled=(not is_owner)}} +
+ +
+
+ {{~! Squash whitespace so that placeholder is displayed when empty. ~}} +
+
+
- {{> ../dropdown_widget_with_label - widget_name="realm_can_manage_all_groups" - label=(t 'Who can manage user groups') - value_type="number" - is_setting_disabled=(not is_owner)}} +
+ +
+
+ {{~! Squash whitespace so that placeholder is displayed when empty. ~}} +
+
+
{{> ../dropdown_widget_with_label widget_name="realm_can_add_custom_emoji_group"