settings: Use new UI for can_add_custom_emoji_group setting.

This commit is contained in:
Sahil Batra 2024-10-29 15:59:01 +05:30 committed by Tim Abbott
parent dce229ba17
commit fb1c7fffa2
4 changed files with 13 additions and 8 deletions

View File

@ -478,7 +478,6 @@ const dropdown_widget_map = new Map<string, DropdownWidget | null>([
["realm_default_code_block_language", null],
["can_remove_subscribers_group", null],
["realm_can_access_all_users_group", null],
["realm_can_add_custom_emoji_group", null],
["realm_can_create_web_public_channel_group", null],
["realm_can_delete_any_message_group", null],
["realm_can_delete_own_message_group", null],
@ -795,7 +794,6 @@ export function check_realm_settings_property_changed(elem: HTMLElement): boolea
case "realm_zulip_update_announcements_stream_id":
case "realm_default_code_block_language":
case "realm_can_access_all_users_group":
case "realm_can_add_custom_emoji_group":
case "realm_can_create_web_public_channel_group":
case "realm_can_delete_any_message_group":
case "realm_can_delete_own_message_group":
@ -803,6 +801,7 @@ export function check_realm_settings_property_changed(elem: HTMLElement): boolea
case "realm_can_move_messages_between_topics_group":
proposed_val = get_dropdown_list_widget_setting_value($elem);
break;
case "realm_can_add_custom_emoji_group":
case "realm_can_create_groups":
case "realm_can_create_public_channel_group":
case "realm_can_create_private_channel_group":
@ -1469,6 +1468,7 @@ export const group_setting_widget_map = new Map<string, GroupSettingPillContaine
["can_leave_group", null],
["can_manage_group", null],
["can_mention_group", null],
["realm_can_add_custom_emoji_group", null],
["realm_can_create_groups", null],
["realm_can_create_public_channel_group", null],
["realm_can_create_private_channel_group", null],
@ -1577,6 +1577,7 @@ export function create_group_setting_widget({
}
type realm_group_setting_name =
| "can_add_custom_emoji_group"
| "can_create_groups"
| "can_create_public_channel_group"
| "can_create_private_channel_group"

View File

@ -605,7 +605,6 @@ export function discard_realm_property_element_changes(elem: HTMLElement): void
case "realm_signup_announcements_stream_id":
case "realm_zulip_update_announcements_stream_id":
case "realm_default_code_block_language":
case "realm_can_add_custom_emoji_group":
case "realm_can_access_all_users_group":
case "realm_can_create_web_public_channel_group":
case "realm_can_delete_any_message_group":
@ -618,6 +617,7 @@ export function discard_realm_property_element_changes(elem: HTMLElement): void
property_value,
);
break;
case "realm_can_add_custom_emoji_group":
case "realm_can_create_groups":
case "realm_can_create_public_channel_group":
case "realm_can_create_private_channel_group":
@ -980,6 +980,7 @@ export function set_up_dropdown_widget_for_realm_group_settings(): void {
);
const settings_using_pills_ui = new Set([
"can_add_custom_emoji_group",
"can_create_groups",
"can_create_public_channel_group",
"can_create_private_channel_group",
@ -1216,6 +1217,10 @@ function initialize_group_setting_widgets(): void {
setting_name: "direct_message_permission_group",
pill_update_callback: check_disable_direct_message_initiator_group_widget,
});
settings_components.create_realm_group_setting_widget({
$pill_container: $("#id_realm_can_add_custom_emoji_group"),
setting_name: "can_add_custom_emoji_group",
});
enable_or_disable_group_permission_settings();
check_disable_direct_message_initiator_group_widget();

View File

@ -287,7 +287,7 @@ export const realm_schema = z.object({
realm_bot_creation_policy: z.number(),
realm_bot_domain: z.string(),
realm_can_access_all_users_group: z.number(),
realm_can_add_custom_emoji_group: z.number(),
realm_can_add_custom_emoji_group: group_setting_value_schema,
realm_can_create_groups: group_setting_value_schema,
realm_can_create_public_channel_group: group_setting_value_schema,
realm_can_create_private_channel_group: group_setting_value_schema,

View File

@ -338,10 +338,9 @@
setting_name="realm_can_manage_all_groups"
label=(t 'Who can manage user groups')}}
{{> ../dropdown_widget_with_label
widget_name="realm_can_add_custom_emoji_group"
label=(t 'Who can add custom emoji')
value_type="number"}}
{{> group_setting_value_pill_input
setting_name="realm_can_add_custom_emoji_group"
label=(t 'Who can add custom emoji')}}
</div>
</div>
</form>