From 215568aae2325073ca99d3eebc6f1923a9b355ef Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Sat, 10 Jun 2017 13:49:07 -0700 Subject: [PATCH] actions.py: Remove transaction.atomic from do_start_email_change_process. Don't think it's necessary? --- zerver/lib/actions.py | 19 +++++++++---------- zerver/tests/test_signup.py | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 90ab08b8b5..e5de4c63fc 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -636,17 +636,16 @@ def do_start_email_change_process(user_profile, new_email): 'new_email': new_email, } - with transaction.atomic(): - obj = EmailChangeStatus.objects.create(new_email=new_email, - old_email=old_email, - user_profile=user_profile, - realm=user_profile.realm) + obj = EmailChangeStatus.objects.create(new_email=new_email, + old_email=old_email, + user_profile=user_profile, + realm=user_profile.realm) - EmailChangeConfirmation.objects.send_confirmation( - obj, 'zerver/emails/confirm_new_email', new_email, - additional_context=context, - host=user_profile.realm.host, - ) + EmailChangeConfirmation.objects.send_confirmation( + obj, 'zerver/emails/confirm_new_email', new_email, + additional_context=context, + host=user_profile.realm.host, + ) def compute_irc_user_fullname(email): # type: (NonBinaryStr) -> NonBinaryStr diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index 87cd306457..1ccb7034fe 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -268,7 +268,7 @@ class LoginTest(ZulipTestCase): with queries_captured() as queries: self.register(self.nonreg_email('test'), "test") # Ensure the number of queries we make is not O(streams) - self.assert_length(queries, 47) + self.assert_length(queries, 46) user_profile = self.nonreg_user('test') self.assertEqual(get_session_dict_user(self.client.session), user_profile.id) self.assertFalse(user_profile.enable_stream_desktop_notifications)