diff --git a/templates/zerver/emails/confirm_registration.source.html b/templates/zerver/emails/confirm_registration.source.html index 7c3e153b4c..5279217ee4 100644 --- a/templates/zerver/emails/confirm_registration.source.html +++ b/templates/zerver/emails/confirm_registration.source.html @@ -6,10 +6,18 @@ {% block content %}

+ {% if create_realm %} + {{ _('You have requested a new Zulip organization. Awesome!') }} + {% else %} {{ _('You recently signed up for Zulip. Awesome!') }} + {% endif %}

+ {% if create_realm %} + {{ _('Click the button below to create the organization and register your account.') }} + {% else %} {{ _('Click the button below to complete registration.') }} + {% endif %} {{ _('Complete registration') }}

{% trans support_email=macros.email_tag(support_email) %}Contact us any time at {{ support_email }} if you run into trouble, have any feedback, or just want to chat!{% endtrans %}

diff --git a/templates/zerver/emails/confirm_registration.subject.txt b/templates/zerver/emails/confirm_registration.subject.txt index e300126e0a..2b412f3943 100644 --- a/templates/zerver/emails/confirm_registration.subject.txt +++ b/templates/zerver/emails/confirm_registration.subject.txt @@ -1 +1,5 @@ +{% if create_realm %} +{{ _("Create your Zulip organization") }} +{% else %} {{ _("Activate your Zulip account") }} +{% endif %} diff --git a/templates/zerver/emails/confirm_registration.txt b/templates/zerver/emails/confirm_registration.txt index e381cd3357..8820b3b729 100644 --- a/templates/zerver/emails/confirm_registration.txt +++ b/templates/zerver/emails/confirm_registration.txt @@ -1,6 +1,14 @@ +{% if create_realm %} +{{ _('You have requested a new Zulip organization. Awesome!') }} +{% else %} {{ _('You recently signed up for Zulip. Awesome!') }} +{% endif %} -{{ _('Click the link below to complete registration.') }} +{% if create_realm %} +{{ _('Click the button below to create the organization and register your account.') }} +{% else %} +{{ _('Click the button below to complete registration.') }} +{% endif %} <{{ activate_url }}> {% trans %}Contact us any time at {{ support_email }} if you run into trouble,have any feedback, or just want to chat!{% endtrans %} diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py index 652777f195..f9e41decac 100644 --- a/zerver/lib/test_classes.py +++ b/zerver/lib/test_classes.py @@ -649,6 +649,8 @@ Output: email_address: str, *, url_pattern: Optional[str] = None, + email_subject_contains: Optional[str] = None, + email_body_contains: Optional[str] = None, ) -> str: from django.core.mail import outbox @@ -661,6 +663,13 @@ Output: ): match = re.search(url_pattern, message.body) assert match is not None + + if email_subject_contains: + self.assertIn(email_subject_contains, message.subject) + + if email_body_contains: + self.assertIn(email_body_contains, message.body) + [confirmation_url] = match.groups() return confirmation_url else: diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index a990ca2c84..a68484ea94 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -2769,8 +2769,13 @@ class RealmCreationTest(ZulipTestCase): result = self.client_get(result["Location"]) self.assert_in_response("Check your email so we can get started.", result) - # Visit the confirmation link. - confirmation_url = self.get_confirmation_url_from_outbox(email) + # Check confirmation email has the correct subject and body, extract + # confirmation link and visit it + confirmation_url = self.get_confirmation_url_from_outbox( + email, + email_subject_contains="Create your Zulip organization", + email_body_contains="You have requested a new Zulip organization", + ) result = self.client_get(confirmation_url) self.assertEqual(result.status_code, 200) diff --git a/zerver/views/registration.py b/zerver/views/registration.py index c86929e76f..8d5b070401 100644 --- a/zerver/views/registration.py +++ b/zerver/views/registration.py @@ -534,7 +534,10 @@ def send_confirm_registration_email( to_emails=[email], from_address=FromAddress.tokenized_no_reply_address(), language=language, - context={"activate_url": activation_url}, + context={ + "create_realm": (realm is None), + "activate_url": activation_url, + }, realm=realm, )