mirror of https://github.com/zulip/zulip.git
user_groups: Update edit_user_group codepath to send event on commit.
Earlier, we were using 'send_event' in 'edit_user_group' codepath which can lead to a situation where we enqueue events but the function fails at a later stage. Events should not be sent until we know we're not rolling back. Fixes part of #30489.
This commit is contained in:
parent
69a2775e9b
commit
66ff646e99
|
@ -213,7 +213,7 @@ def do_send_user_group_update_event(
|
|||
user_group: NamedUserGroup, data: dict[str, str | int | AnonymousSettingGroupDict]
|
||||
) -> None:
|
||||
event = dict(type="user_group", op="update", group_id=user_group.id, data=data)
|
||||
send_event(user_group.realm, event, active_user_ids(user_group.realm_id))
|
||||
send_event_on_commit(user_group.realm, event, active_user_ids(user_group.realm_id))
|
||||
|
||||
|
||||
@transaction.atomic(savepoint=False)
|
||||
|
|
|
@ -95,7 +95,7 @@ def get_user_group(request: HttpRequest, user_profile: UserProfile) -> HttpRespo
|
|||
return json_success(request, data={"user_groups": user_groups})
|
||||
|
||||
|
||||
@transaction.atomic
|
||||
@transaction.atomic(durable=True)
|
||||
@require_user_group_edit_permission
|
||||
@typed_endpoint
|
||||
def edit_user_group(
|
||||
|
|
Loading…
Reference in New Issue