mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
user_groups: Use group picker for can_mention_group.
This commit is contained in:
committed by
Tim Abbott
parent
05a6d7f870
commit
8055617900
@@ -112,39 +112,19 @@ function update_group_permission_settings_elements(group) {
|
||||
// We are concerend with the General tab for changing group permissions.
|
||||
const $group_permission_settings = $("#group_permission_settings");
|
||||
|
||||
// Otherwise, we adjust whether the widgets are disabled based on
|
||||
// whether this user is authorized to change the group settings.
|
||||
const $permission_dropdown_elements =
|
||||
$group_permission_settings.find(".dropdown-widget-button");
|
||||
|
||||
const $permission_pill_container_elements = $group_permission_settings.find(".pill-container");
|
||||
|
||||
if (settings_data.can_manage_user_group(group.id)) {
|
||||
$permission_dropdown_elements.prop("disabled", false);
|
||||
$permission_pill_container_elements.find(".input").prop("contenteditable", true);
|
||||
$permission_pill_container_elements.removeClass("group_setting_disabled");
|
||||
|
||||
$permission_dropdown_elements.each(function () {
|
||||
const $dropdown_wrapper = $(this).closest(".dropdown_widget_with_label_wrapper");
|
||||
$dropdown_wrapper[0]._tippy?.destroy();
|
||||
});
|
||||
|
||||
$permission_pill_container_elements.each(function () {
|
||||
$(this)[0]._tippy?.destroy();
|
||||
});
|
||||
} else {
|
||||
$permission_dropdown_elements.prop("disabled", true);
|
||||
$permission_pill_container_elements.find(".input").prop("contenteditable", false);
|
||||
$permission_pill_container_elements.addClass("group_setting_disabled");
|
||||
|
||||
$permission_dropdown_elements.each(function () {
|
||||
const $dropdown_wrapper = $(this).closest(".dropdown_widget_with_label_wrapper");
|
||||
settings_components.initialize_disable_btn_hint_popover(
|
||||
$dropdown_wrapper,
|
||||
$t({defaultMessage: "You do not have permission to edit this setting."}),
|
||||
);
|
||||
});
|
||||
|
||||
$permission_pill_container_elements.each(function () {
|
||||
settings_components.initialize_disable_btn_hint_popover(
|
||||
$(this),
|
||||
@@ -167,7 +147,6 @@ function show_membership_settings(group) {
|
||||
}
|
||||
|
||||
function show_general_settings(group) {
|
||||
user_group_components.setup_permissions_dropdown("can_mention_group", group, false);
|
||||
const $edit_container = get_edit_container(group);
|
||||
settings_components.create_group_setting_widget({
|
||||
$pill_container: $edit_container.find(".can-add-members-group-container .pill-container"),
|
||||
@@ -196,6 +175,13 @@ function show_general_settings(group) {
|
||||
setting_type: "group",
|
||||
group,
|
||||
});
|
||||
|
||||
settings_components.create_group_setting_widget({
|
||||
$pill_container: $edit_container.find(".can-mention-group-container .pill-container"),
|
||||
setting_name: "can_mention_group",
|
||||
setting_type: "group",
|
||||
group,
|
||||
});
|
||||
update_general_panel_ui(group);
|
||||
}
|
||||
|
||||
@@ -659,6 +645,7 @@ export function update_group(event) {
|
||||
}
|
||||
if (event.data.can_mention_group !== undefined) {
|
||||
sync_group_permission_setting("can_mention_group", group);
|
||||
update_group_management_ui();
|
||||
}
|
||||
if (event.data.can_add_members_group !== undefined) {
|
||||
sync_group_permission_setting("can_add_members_group", group);
|
||||
|
||||
Reference in New Issue
Block a user