From 3332ebaf2206b55f634885fcdc3d49af3be123c8 Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Sat, 10 Jun 2017 12:34:57 -0700 Subject: [PATCH] emails: Remove confirmation_registration_mit. Not enough new Zephyr signups to justify the carrying cost :(. --- .../emails/confirm_registration_mit.subject | 1 - .../emails/confirm_registration_mit.txt | 21 --------------- zerver/tests/test_signup.py | 26 ------------------- zerver/tests/test_templates.py | 2 -- zerver/views/registration.py | 14 ++-------- zerver/views/test_emails.py | 2 +- 6 files changed, 3 insertions(+), 63 deletions(-) delete mode 100644 templates/zerver/emails/confirm_registration_mit.subject delete mode 100644 templates/zerver/emails/confirm_registration_mit.txt diff --git a/templates/zerver/emails/confirm_registration_mit.subject b/templates/zerver/emails/confirm_registration_mit.subject deleted file mode 100644 index eba022bcd9..0000000000 --- a/templates/zerver/emails/confirm_registration_mit.subject +++ /dev/null @@ -1 +0,0 @@ -Activate your Zulip account diff --git a/templates/zerver/emails/confirm_registration_mit.txt b/templates/zerver/emails/confirm_registration_mit.txt deleted file mode 100644 index 036f54814e..0000000000 --- a/templates/zerver/emails/confirm_registration_mit.txt +++ /dev/null @@ -1,21 +0,0 @@ -Hello, - -Thanks for giving Zulip a try! - -There are a few steps you need to take to ensure Zulip works with your -MIT Zephyr account. - - 1) Create a password and activate your account: - <{{ activate_url }}> - - 2) Follow the instructions on to setup - the Zephyr mirroring system. - -Feel free to send us a message via the Feedback button under the gear -tab within the app if you have any questions or encounter any -problems. - - -Cheers, - -All of us here at Zulip diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index 1ccb7034fe..e80533504f 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -1509,32 +1509,6 @@ class UserSignUpTest(ZulipTestCase): mock_ldap.reset() mock_initialize.stop() - @patch('DNS.dnslookup', return_value=[['sipbtest:*:20922:101:Fred Sipb,,,:/mit/sipbtest:/bin/athena/tcsh']]) - def test_registration_email_for_mirror_dummy_user(self, ignored): - # type: (Any) -> None - user_profile = self.mit_user("sipbtest") - email = user_profile.email - user_profile.is_mirror_dummy = True - user_profile.is_active = False - user_profile.save() - - with self.settings(REALMS_HAVE_SUBDOMAINS=True): - with patch('zerver.forms.get_subdomain', return_value='zephyr'): - with patch('zerver.views.registration.get_subdomain', return_value='zephyr'): - result = self.client_post('/accounts/home/', {'email': email}) - self.assertEqual(result.status_code, 302) - - from django.core.mail import outbox - for message in reversed(outbox): - if email in message.to: - # The main difference between the zephyr registation email - # and the normal one is this string - index = message.body.find('https://zephyr.zulipchat.com/zephyr') - if index >= 0: - return - else: - raise AssertionError("Couldn't find the right confirmation email.") - @patch('DNS.dnslookup', return_value=[['sipbtest:*:20922:101:Fred Sipb,,,:/mit/sipbtest:/bin/athena/tcsh']]) def test_registration_of_mirror_dummy_user(self, ignored): # type: (Any) -> None diff --git a/zerver/tests/test_templates.py b/zerver/tests/test_templates.py index bd7cd59ed8..a8defbd2b2 100644 --- a/zerver/tests/test_templates.py +++ b/zerver/tests/test_templates.py @@ -86,8 +86,6 @@ class TemplateTestCase(ZulipTestCase): 'zerver/delete_message.html', ] unusual = [ - 'zerver/emails/confirm_registration_mit.txt', - 'zerver/emails/confirm_registration_mit.subject', 'zerver/emails/invitation_mit.txt', 'zerver/emails/invitation_mit.subject', 'zerver/emails/confirm_new_email.subject', diff --git a/zerver/views/registration.py b/zerver/views/registration.py index e86e0a76db..b3646048d2 100644 --- a/zerver/views/registration.py +++ b/zerver/views/registration.py @@ -297,19 +297,9 @@ def send_registration_completion_email(email, request, realm_creation=False): Send an email with a confirmation link to the provided e-mail so the user can complete their registration. """ - template_prefix = 'zerver/emails/confirm_registration' - # Note: to make the following work in the non-subdomains case, you'll - # need to copy the logic from the beginning of accounts_register to - # figure out which realm the user is trying to sign up for, and then - # check if it is a zephyr mirror realm. - if settings.REALMS_HAVE_SUBDOMAINS: - realm = get_realm(get_subdomain(request)) - if realm and realm.is_zephyr_mirror_realm: - template_prefix = 'zerver/emails/confirm_registration_mit' - prereg_user = create_preregistration_user(email, request, realm_creation) - return Confirmation.objects.send_confirmation(prereg_user, template_prefix, email, - host=request.get_host()) + return Confirmation.objects.send_confirmation( + prereg_user, 'zerver/emails/confirm_registration', email, host=request.get_host()) def redirect_to_email_login_url(email): # type: (str) -> HttpResponseRedirect diff --git a/zerver/views/test_emails.py b/zerver/views/test_emails.py index 74a6f77834..851806cfa6 100755 --- a/zerver/views/test_emails.py +++ b/zerver/views/test_emails.py @@ -57,7 +57,7 @@ def email_page(request): } templates = [ - 'confirm_registration', 'invitation', 'invitation_reminder', 'confirm_registration_mit', + 'confirm_registration', 'invitation', 'invitation_reminder', 'invitation_mit', 'followup_day1', 'followup_day2', 'missed_message', 'digest', 'find_team', 'password_reset', 'confirm_new_email', 'notify_change_in_email', 'notify_new_login']