user_groups: Add deactivated field to NamedUserGroup model.

This commit is contained in:
Sahil Batra
2024-05-15 18:46:05 +05:30
committed by Tim Abbott
parent f0c0eef8dc
commit bef7cfe00f
4 changed files with 23 additions and 3 deletions

View File

@@ -614,7 +614,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"]),
@@ -622,12 +622,13 @@ 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(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)
INSERT INTO zerver_namedusergroup (usergroup_ptr_id, realm_id, name, description, is_system_group, can_manage_group_id, can_mention_group_id, deactivated)
VALUES {rows}
"""
).format(rows=SQL(", ").join(rows))