mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
message_send: Update do_send_messages codepath to send event on commit.
Earlier, we were using 'send_event' & 'queue_json_publish' in 'do_send_messages' which can lead to a situation where we enqueue events but the transaction fails at a later stage. Events should not be sent until we know we're not rolling back.
This commit is contained in:
committed by
Tim Abbott
parent
27c4e46b30
commit
c798d192dc
@@ -1154,9 +1154,10 @@ class MissedMessageHookTest(ZulipTestCase):
|
||||
def test_disable_external_notifications(self) -> None:
|
||||
# The disable_external_notifications parameter, used for messages sent by welcome bot,
|
||||
# should result in no email/push notifications being sent regardless of the message type.
|
||||
msg_id = internal_send_private_message(
|
||||
self.iago, self.user_profile, "Test Content", disable_external_notifications=True
|
||||
)
|
||||
with self.captureOnCommitCallbacks(execute=True):
|
||||
msg_id = internal_send_private_message(
|
||||
self.iago, self.user_profile, "Test Content", disable_external_notifications=True
|
||||
)
|
||||
assert msg_id is not None
|
||||
with mock.patch("zerver.tornado.event_queue.maybe_enqueue_notifications") as mock_enqueue:
|
||||
missedmessage_hook(self.user_profile.id, self.client_descriptor, True)
|
||||
|
||||
Reference in New Issue
Block a user