mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
user_groups: Add can_join_group setting for user group.
This field will be used to control permission for who can join a user group. Fixes part of #25938.
This commit is contained in:
@@ -819,7 +819,7 @@ def bulk_create_system_user_groups(groups: list[dict[str, str]], realm: Realm) -
|
||||
user_group_ids = [id for (id,) in cursor.fetchall()]
|
||||
|
||||
rows = [
|
||||
SQL("({},{},{},{},{},{},{},{})").format(
|
||||
SQL("({},{},{},{},{},{},{},{},{})").format(
|
||||
Literal(user_group_ids[idx]),
|
||||
Literal(realm.id),
|
||||
Literal(group["name"]),
|
||||
@@ -827,13 +827,14 @@ def bulk_create_system_user_groups(groups: list[dict[str, str]], realm: Realm) -
|
||||
Literal(True),
|
||||
Literal(initial_group_setting_value),
|
||||
Literal(initial_group_setting_value),
|
||||
Literal(initial_group_setting_value),
|
||||
Literal(False),
|
||||
)
|
||||
for idx, group in enumerate(groups)
|
||||
]
|
||||
query = SQL(
|
||||
"""
|
||||
INSERT INTO zerver_namedusergroup (usergroup_ptr_id, realm_id, name, description, is_system_group, can_manage_group_id, can_mention_group_id, deactivated)
|
||||
INSERT INTO zerver_namedusergroup (usergroup_ptr_id, realm_id, name, description, is_system_group, can_join_group_id, can_manage_group_id, can_mention_group_id, deactivated)
|
||||
VALUES {rows}
|
||||
"""
|
||||
).format(rows=SQL(", ").join(rows))
|
||||
@@ -915,7 +916,7 @@ def create_system_user_groups_for_realm(realm: Realm) -> dict[int, NamedUserGrou
|
||||
user_group = set_defaults_for_group_settings(group, {}, system_groups_name_dict)
|
||||
groups_with_updated_settings.append(user_group)
|
||||
NamedUserGroup.objects.bulk_update(
|
||||
groups_with_updated_settings, ["can_manage_group", "can_mention_group"]
|
||||
groups_with_updated_settings, ["can_join_group", "can_manage_group", "can_mention_group"]
|
||||
)
|
||||
|
||||
subgroup_objects: list[GroupGroupMembership] = []
|
||||
|
||||
Reference in New Issue
Block a user