Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_groups: Make system groups creation atomic.
Zixuan James Lib67c35482682
diff --git a/zerver/lib/user_groups.py b/zerver/lib/user_groups.pyindex dcd6bcc7080..2960b72b556 100644--- a/zerver/lib/user_groups.py+++ b/zerver/lib/user_groups.py@@ -1,5 +1,6 @@from typing import Dict, Iterable, List, Sequence, TypedDict+from django.db import transactionfrom django.db.models import F, QuerySetfrom django.utils.translation import gettext as _from django_cte import With@@ -215,6 +216,7 @@ def get_subgroup_ids(user_group: UserGroup, *, direct_subgroup_only: bool = Falsreturn list(subgroup_ids)[email protected](savepoint=False)def create_system_user_groups_for_realm(realm: Realm) -> Dict[int, UserGroup]:"""Any changes to this function likely require a migration to adjustexisting realms. See e.g. migration 0382_create_role_based_system_groups.py,