user_groups: Allow setting and changing can_join_group setting.

Fixes part of #25938.
This commit is contained in:
Sahil Batra
2024-10-02 17:17:50 +05:30
committed by Tim Abbott
parent 701e391def
commit 7a1277ea95
7 changed files with 38 additions and 6 deletions

View File

@@ -917,6 +917,7 @@ export function check_group_property_changed(elem: HTMLElement, group: UserGroup
const current_val = get_group_property_value(property_name, group);
let proposed_val;
switch (property_name) {
case "can_join_group":
case "can_manage_group": {
const pill_widget = get_group_setting_widget(property_name);
assert(pill_widget !== null);
@@ -1402,7 +1403,8 @@ export function initialize_disable_btn_hint_popover(
tippy.default(util.the($btn_wrapper), tippy_opts);
}
const group_setting_widget_map = new Map<string, GroupSettingPillContainer | null>([
export const group_setting_widget_map = new Map<string, GroupSettingPillContainer | null>([
["can_join_group", null],
["can_manage_group", null],
]);
@@ -1446,7 +1448,7 @@ export function set_group_setting_widget_value(
export type GroupSettingType = z.output<typeof group_setting_type_schema>;
type group_setting_name = "can_manage_group";
type group_setting_name = "can_manage_group" | "can_join_group";
export function create_group_setting_widget({
$pill_container,