mirror of https://github.com/zulip/zulip.git
settings: Use new pills UI for move message permission settings.
This commit is contained in:
parent
d9f4c473fb
commit
b8bc20e87c
|
@ -481,8 +481,6 @@ const dropdown_widget_map = new Map<string, DropdownWidget | 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_move_messages_between_channels_group", null],
|
||||
["realm_can_move_messages_between_topics_group", null],
|
||||
]);
|
||||
|
||||
export function get_widget_for_dropdown_list_settings(
|
||||
|
@ -797,8 +795,6 @@ export function check_realm_settings_property_changed(elem: HTMLElement): boolea
|
|||
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_move_messages_between_channels_group":
|
||||
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":
|
||||
|
@ -806,6 +802,8 @@ export function check_realm_settings_property_changed(elem: HTMLElement): boolea
|
|||
case "realm_can_create_public_channel_group":
|
||||
case "realm_can_create_private_channel_group":
|
||||
case "realm_can_manage_all_groups":
|
||||
case "realm_can_move_messages_between_channels_group":
|
||||
case "realm_can_move_messages_between_topics_group":
|
||||
case "realm_create_multiuse_invite_group":
|
||||
case "realm_direct_message_initiator_group":
|
||||
case "realm_direct_message_permission_group": {
|
||||
|
@ -1473,6 +1471,8 @@ export const group_setting_widget_map = new Map<string, GroupSettingPillContaine
|
|||
["realm_can_create_public_channel_group", null],
|
||||
["realm_can_create_private_channel_group", null],
|
||||
["realm_can_manage_all_groups", null],
|
||||
["realm_can_move_messages_between_channels_group", null],
|
||||
["realm_can_move_messages_between_topics_group", null],
|
||||
["realm_create_multiuse_invite_group", null],
|
||||
["realm_direct_message_initiator_group", null],
|
||||
["realm_direct_message_permission_group", null],
|
||||
|
@ -1582,6 +1582,8 @@ type realm_group_setting_name =
|
|||
| "can_create_public_channel_group"
|
||||
| "can_create_private_channel_group"
|
||||
| "can_manage_all_groups"
|
||||
| "can_move_messages_between_channels_group"
|
||||
| "can_move_messages_between_topics_group"
|
||||
| "create_multiuse_invite_group"
|
||||
| "direct_message_initiator_group"
|
||||
| "direct_message_permission_group";
|
||||
|
|
|
@ -515,8 +515,6 @@ export function discard_realm_property_element_changes(elem: HTMLElement): void
|
|||
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_move_messages_between_channels_group":
|
||||
case "realm_can_move_messages_between_topics_group":
|
||||
assert(typeof property_value === "string" || typeof property_value === "number");
|
||||
settings_components.set_dropdown_list_widget_setting_value(
|
||||
property_name,
|
||||
|
@ -528,6 +526,8 @@ export function discard_realm_property_element_changes(elem: HTMLElement): void
|
|||
case "realm_can_create_public_channel_group":
|
||||
case "realm_can_create_private_channel_group":
|
||||
case "realm_can_manage_all_groups":
|
||||
case "realm_can_move_messages_between_channels_group":
|
||||
case "realm_can_move_messages_between_topics_group":
|
||||
case "realm_create_multiuse_invite_group":
|
||||
case "realm_direct_message_initiator_group":
|
||||
case "realm_direct_message_permission_group": {
|
||||
|
@ -887,6 +887,8 @@ export function set_up_dropdown_widget_for_realm_group_settings(): void {
|
|||
"can_create_public_channel_group",
|
||||
"can_create_private_channel_group",
|
||||
"can_manage_all_groups",
|
||||
"can_move_messages_between_channels_group",
|
||||
"can_move_messages_between_topics_group",
|
||||
"create_multiuse_invite_group",
|
||||
"direct_message_initiator_group",
|
||||
"direct_message_permission_group",
|
||||
|
@ -1094,6 +1096,14 @@ function initialize_group_setting_widgets(): void {
|
|||
$pill_container: $("#id_realm_can_add_custom_emoji_group"),
|
||||
setting_name: "can_add_custom_emoji_group",
|
||||
});
|
||||
settings_components.create_realm_group_setting_widget({
|
||||
$pill_container: $("#id_realm_can_move_messages_between_channels_group"),
|
||||
setting_name: "can_move_messages_between_channels_group",
|
||||
});
|
||||
settings_components.create_realm_group_setting_widget({
|
||||
$pill_container: $("#id_realm_can_move_messages_between_topics_group"),
|
||||
setting_name: "can_move_messages_between_topics_group",
|
||||
});
|
||||
|
||||
enable_or_disable_group_permission_settings();
|
||||
check_disable_direct_message_initiator_group_widget();
|
||||
|
|
|
@ -295,8 +295,8 @@ export const realm_schema = z.object({
|
|||
realm_can_delete_any_message_group: z.number(),
|
||||
realm_can_delete_own_message_group: z.number(),
|
||||
realm_can_manage_all_groups: group_setting_value_schema,
|
||||
realm_can_move_messages_between_channels_group: z.number(),
|
||||
realm_can_move_messages_between_topics_group: z.number(),
|
||||
realm_can_move_messages_between_channels_group: group_setting_value_schema,
|
||||
realm_can_move_messages_between_topics_group: group_setting_value_schema,
|
||||
realm_create_multiuse_invite_group: group_setting_value_schema,
|
||||
realm_date_created: z.number(),
|
||||
realm_default_code_block_language: z.string(),
|
||||
|
|
|
@ -173,10 +173,9 @@
|
|||
{{> settings_save_discard_widget section_name="moving-msgs" }}
|
||||
</div>
|
||||
|
||||
{{> ../dropdown_widget_with_label
|
||||
widget_name="realm_can_move_messages_between_topics_group"
|
||||
label=(t 'Who can move messages to another topic')
|
||||
value_type="number" }}
|
||||
{{> group_setting_value_pill_input
|
||||
setting_name="realm_can_move_messages_between_topics_group"
|
||||
label=(t 'Who can move messages to another topic')}}
|
||||
|
||||
<div class="input-group time-limit-setting">
|
||||
<label for="realm_move_messages_within_stream_limit_seconds" class="settings-field-label">{{t "Time limit for editing topics" }} <i>({{t "does not apply to moderators and administrators" }})</i></label>
|
||||
|
@ -196,10 +195,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{> ../dropdown_widget_with_label
|
||||
widget_name="realm_can_move_messages_between_channels_group"
|
||||
label=(t 'Who can move messages to another channel')
|
||||
value_type="number" }}
|
||||
{{> group_setting_value_pill_input
|
||||
setting_name="realm_can_move_messages_between_channels_group"
|
||||
label=(t 'Who can move messages to another channel')}}
|
||||
|
||||
<div class="input-group time-limit-setting">
|
||||
<label for="realm_move_messages_between_streams_limit_seconds" class="settings-field-label">{{t "Time limit for moving messages between channels" }} <i>({{t "does not apply to moderators and administrators" }})</i></label>
|
||||
|
|
Loading…
Reference in New Issue