Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
actions: Use transaction.atomic for do_change_default_events_register_stream.
Sahil Batra4a7461361e1a
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 03abca69817..dae375e3adf 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -4849,6 +4849,7 @@ def do_change_default_sending_stream()[email protected](durable=True)def do_change_default_events_register_stream(user_profile: UserProfile, stream: Optional[Stream], *, acting_user: Optional[UserProfile]) -> None:@@ -4876,17 +4877,21 @@ def do_change_default_events_register_stream(stream_name: Optional[str] = stream.nameelse:stream_name = None- send_event(- user_profile.realm,- dict(- type="realm_bot",- op="update",- bot=dict(- user_id=user_profile.id,- default_events_register_stream=stream_name,- ),++ event = dict(+ type="realm_bot",+ op="update",+ bot=dict(+ user_id=user_profile.id,+ default_events_register_stream=stream_name,),- bot_owner_user_ids(user_profile),+ )+ transaction.on_commit(+ lambda: send_event(+ user_profile.realm,+ event,+ bot_owner_user_ids(user_profile),+ ))