mirror of https://github.com/zulip/zulip.git
user_groups: Add deactivated field to NamedUserGroup model.
This commit is contained in:
parent
f0c0eef8dc
commit
bef7cfe00f
|
@ -753,13 +753,14 @@ def bulk_import_named_user_groups(data: TableData) -> None:
|
||||||
group["is_system_group"],
|
group["is_system_group"],
|
||||||
group["can_manage_group_id"],
|
group["can_manage_group_id"],
|
||||||
group["can_mention_group_id"],
|
group["can_mention_group_id"],
|
||||||
|
group["deactivated"],
|
||||||
)
|
)
|
||||||
for group in data["zerver_namedusergroup"]
|
for group in data["zerver_namedusergroup"]
|
||||||
]
|
]
|
||||||
|
|
||||||
query = SQL(
|
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 %s
|
VALUES %s
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
|
@ -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()]
|
user_group_ids = [id for (id,) in cursor.fetchall()]
|
||||||
|
|
||||||
rows = [
|
rows = [
|
||||||
SQL("({},{},{},{},{},{},{})").format(
|
SQL("({},{},{},{},{},{},{},{})").format(
|
||||||
Literal(user_group_ids[idx]),
|
Literal(user_group_ids[idx]),
|
||||||
Literal(realm.id),
|
Literal(realm.id),
|
||||||
Literal(group["name"]),
|
Literal(group["name"]),
|
||||||
|
@ -622,12 +622,13 @@ def bulk_create_system_user_groups(groups: list[dict[str, str]], realm: Realm) -
|
||||||
Literal(True),
|
Literal(True),
|
||||||
Literal(initial_group_setting_value),
|
Literal(initial_group_setting_value),
|
||||||
Literal(initial_group_setting_value),
|
Literal(initial_group_setting_value),
|
||||||
|
Literal(False),
|
||||||
)
|
)
|
||||||
for idx, group in enumerate(groups)
|
for idx, group in enumerate(groups)
|
||||||
]
|
]
|
||||||
query = SQL(
|
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}
|
VALUES {rows}
|
||||||
"""
|
"""
|
||||||
).format(rows=SQL(", ").join(rows))
|
).format(rows=SQL(", ").join(rows))
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 5.0.6 on 2024-05-15 13:12
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("zerver", "0577_merge_20240829_0153"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="namedusergroup",
|
||||||
|
name="deactivated",
|
||||||
|
field=models.BooleanField(default=False, db_default=False),
|
||||||
|
),
|
||||||
|
]
|
|
@ -60,6 +60,7 @@ class NamedUserGroup(UserGroup): # type: ignore[django-manager-missing] # djang
|
||||||
)
|
)
|
||||||
|
|
||||||
realm_for_sharding = models.ForeignKey("zerver.Realm", on_delete=CASCADE, db_column="realm_id")
|
realm_for_sharding = models.ForeignKey("zerver.Realm", on_delete=CASCADE, db_column="realm_id")
|
||||||
|
deactivated = models.BooleanField(default=False, db_default=False)
|
||||||
|
|
||||||
# We do not have "Full members" and "Everyone on the internet"
|
# We do not have "Full members" and "Everyone on the internet"
|
||||||
# group here since there isn't a separate role value for full
|
# group here since there isn't a separate role value for full
|
||||||
|
|
Loading…
Reference in New Issue