mirror of https://github.com/zulip/zulip.git
settings: Refactor create_group_setting_widget.
This commit updates create_group_setting_widget code to not accept setting type as a a parameter as we would use separate function for realm settings.
This commit is contained in:
parent
35424adcc3
commit
d370499557
|
@ -1476,23 +1476,21 @@ type group_setting_name =
|
|||
export function create_group_setting_widget({
|
||||
$pill_container,
|
||||
setting_name,
|
||||
setting_type,
|
||||
group,
|
||||
}: {
|
||||
$pill_container: JQuery;
|
||||
setting_name: group_setting_name;
|
||||
setting_type: "realm" | "stream" | "group";
|
||||
group?: UserGroup;
|
||||
}): GroupSettingPillContainer {
|
||||
const pill_widget = group_setting_pill.create_pills(
|
||||
$pill_container,
|
||||
const pill_widget = group_setting_pill.create_pills($pill_container, setting_name, "group");
|
||||
const opts: {
|
||||
setting_name: string;
|
||||
group: UserGroup | undefined;
|
||||
setting_type: "group";
|
||||
} = {
|
||||
setting_name,
|
||||
setting_type,
|
||||
);
|
||||
const opts = {
|
||||
setting_name,
|
||||
setting_type,
|
||||
group,
|
||||
setting_type: "group",
|
||||
};
|
||||
group_setting_pill.set_up_pill_typeahead({pill_widget, $pill_container, opts});
|
||||
|
||||
|
|
|
@ -262,31 +262,26 @@ export function set_up_handlers(): void {
|
|||
can_add_members_group_widget = settings_components.create_group_setting_widget({
|
||||
$pill_container: $container.find(".can-add-members-group-container .pill-container"),
|
||||
setting_name: "can_add_members_group",
|
||||
setting_type: "group",
|
||||
});
|
||||
|
||||
const $pill_container = $container.find(".can-manage-group-container .pill-container");
|
||||
can_manage_group_widget = settings_components.create_group_setting_widget({
|
||||
$pill_container,
|
||||
setting_name: "can_manage_group",
|
||||
setting_type: "group",
|
||||
});
|
||||
|
||||
can_join_group_widget = settings_components.create_group_setting_widget({
|
||||
$pill_container: $container.find(".can-join-group-container .pill-container"),
|
||||
setting_name: "can_join_group",
|
||||
setting_type: "group",
|
||||
});
|
||||
|
||||
can_leave_group_widget = settings_components.create_group_setting_widget({
|
||||
$pill_container: $container.find(".can-leave-group-container .pill-container"),
|
||||
setting_name: "can_leave_group",
|
||||
setting_type: "group",
|
||||
});
|
||||
|
||||
can_mention_group_widget = settings_components.create_group_setting_widget({
|
||||
$pill_container: $container.find(".can-mention-group-container .pill-container"),
|
||||
setting_name: "can_mention_group",
|
||||
setting_type: "group",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -154,35 +154,30 @@ function show_general_settings(group) {
|
|||
settings_components.create_group_setting_widget({
|
||||
$pill_container: $edit_container.find(".can-add-members-group-container .pill-container"),
|
||||
setting_name: "can_add_members_group",
|
||||
setting_type: "group",
|
||||
group,
|
||||
});
|
||||
|
||||
settings_components.create_group_setting_widget({
|
||||
$pill_container: $edit_container.find(".can-manage-group-container .pill-container"),
|
||||
setting_name: "can_manage_group",
|
||||
setting_type: "group",
|
||||
group,
|
||||
});
|
||||
|
||||
settings_components.create_group_setting_widget({
|
||||
$pill_container: $edit_container.find(".can-join-group-container .pill-container"),
|
||||
setting_name: "can_join_group",
|
||||
setting_type: "group",
|
||||
group,
|
||||
});
|
||||
|
||||
settings_components.create_group_setting_widget({
|
||||
$pill_container: $edit_container.find(".can-leave-group-container .pill-container"),
|
||||
setting_name: "can_leave_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);
|
||||
|
|
Loading…
Reference in New Issue