handle_missedmessage_emails: Update codepath to queue event on commit.

Earlier, in 'handle_missedmessage_emails' codepath we were using
'queue_json_publish' which can lead to a situation where we enqueue
events but the transaction fails at a later stage.

Events should not be published until we know we're not rolling back.
This commit is contained in:
Prakhar Pratyush
2024-12-04 13:59:38 +05:30
committed by Tim Abbott
parent f0cbce564d
commit 4bef1a510c
5 changed files with 36 additions and 28 deletions

View File

@@ -872,7 +872,8 @@ class PasswordResetTest(ZulipTestCase):
def reset_password() -> None:
# start the password reset process by supplying an email address
result = self.client_post("/accounts/password/reset/", {"email": email})
with self.captureOnCommitCallbacks(execute=True):
result = self.client_post("/accounts/password/reset/", {"email": email})
# check the redirect link telling you to check mail for password reset link
self.assertEqual(result.status_code, 302)