Repository: zulip/zulip

Issue:
Customize "Activate your Zulip account" email when creating a new org
The email generated for creating a new org does not say anywhere that you'll be creating a new org.

![image](https://user-images.githubusercontent.com/2090066/112421854-cc8d8600-8d27-11eb-971b-88fe41fae868.png)

We should probably change:
* subject line -> "Create your Zulip organization"
* text above the button

Draft text (minimally different from current version):
> You have requested a new Zulip organization. Awesome!
> Click the button below to create the organization and register your account.




Discussion:
Hello @zulip/server-development, @zulip/server-onboarding members, this issue was labeled with the "area: emails", "area: onboarding" labels, so you may want to check it out!

<!-- areaLabelAddition -->
Thanks for the report!  That'd be a nice improvement.
@zulipbot claim

Welcome to Zulip, @gupta-piyush19! We just sent you an invite to collaborate on this repository at https://github.com/zulip/zulip/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:
* Join me on the [Zulip developers' server](https://chat.zulip.org), to get help, chat about this issue, and meet the other developers.
* [Unwatch this repository](https://help.github.com/articles/unwatching-repositories/), so that you don't get 100 emails a day.

As you work on this issue, you'll also want to refer to the [Zulip code contribution guide](https://zulip.readthedocs.io/en/latest/contributing/index.html), as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!
@timabbott can you please help me in finding code for this? It is really a large codebase, not able to find the same.
@gupta-piyush19 Zulip's only a medium-size codebase.  But you can generally find anything in a codebase using `git grep` -- e.g. `git grep 'Complete registration'`:

```
...
templates/zerver/emails/confirm_registration.source.html:    <a class="button" href="{{ activate_url }}">{{ _('Complete registration') }}</a>
templates/zerver/emails/invitation.source.html:    <a class="button" href="{{ activate_url }}">{{ _("Complete registration") }}</a>
templates/zerver/emails/invitation_reminder.source.html:    <a class="button" href="{{ activate_url }}">{{ _("Complete registration") }}</a>
```
Check out our [GitHub guide](https://zulip.readthedocs.io/en/latest/git-guide.html) for more useful advice.
Hello Everyone, I am new here #newmember. I am Roushan Kumar from India. Please guide me, I am intereseted in working on this project.
@zulipbot claim
Hello @weilirs, it looks like someone has already claimed this issue! Since we believe multiple assignments to the same issue may cause some confusion, we encourage you to search for other unclaimed issues to work on. However, you can always reclaim this issue if no one is working on it.

We look forward to your valuable contributions!
Hello @gupta-piyush19, you claimed this issue to work on it, but this issue and any referenced pull requests haven't been updated for 10 days. Are you still working on this issue?

If so, please update this issue by leaving a comment on this issue to let me know that you're still working on it. Otherwise, I'll automatically remove you from this issue in 4 days.

If you've decided to work on something else, simply comment `@zulipbot abandon` so that someone else can claim it and continue from where you left off.

Thank you for your valuable contributions to Zulip!

<!-- inactiveWarning -->
@zulipbot claim
@zulipbot claim
Hello @stefanieelling, it looks like we've already sent you a collaboration invite at https://github.com/zulip/zulip/invitations, but you haven't accepted it yet!

Please accept the invite and try to claim this issue again afterwards. We look forward to your contributions!
> Hello @stefanieelling, it looks like we've already sent you a collaboration invite at https://github.com/zulip/zulip/invitations, but you haven't accepted it yet!
> 
> Please accept the invite and try to claim this issue again afterwards. We look forward to your contributions!

@zulipbot can you resend the invitation please?
@zulipbot claim
Welcome to Zulip, @lawynnj! We just sent you an invite to collaborate on this repository at https://github.com/zulip/zulip/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:
* Join me on the [Zulip developers' server](https://chat.zulip.org), to get help, chat about this issue, and meet the other developers.
* [Unwatch this repository](https://help.github.com/articles/unwatching-repositories/), so that you don't get 100 emails a day.

As you work on this issue, you'll also want to refer to the [Zulip code contribution guide](https://zulip.readthedocs.io/en/latest/contributing/index.html), as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!
@zulipbot claim
@zulipbot claim
@zulipbot claim
Welcome to Zulip, @MayurDeshmukh10! We just sent you an invite to collaborate on this repository at https://github.com/zulip/zulip/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:
* Join me on the [Zulip developers' server](https://chat.zulip.org), to get help, chat about this issue, and meet the other developers.
* [Unwatch this repository](https://help.github.com/articles/unwatching-repositories/), so that you don't get 100 emails a day.

As you work on this issue, you'll also want to refer to the [Zulip code contribution guide](https://zulip.readthedocs.io/en/latest/contributing/index.html), as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!
@zulipbot claim
Welcome to Zulip, @gilbertbw! We just sent you an invite to collaborate on this repository at https://github.com/zulip/zulip/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!

Here's some tips to get you off to a good start:
* Join me on the [Zulip developers' server](https://chat.zulip.org), to get help, chat about this issue, and meet the other developers.
* [Unwatch this repository](https://help.github.com/articles/unwatching-repositories/), so that you don't get 100 emails a day.

As you work on this issue, you'll also want to refer to the [Zulip code contribution guide](https://zulip.readthedocs.io/en/latest/contributing/index.html), as well as the rest of the developer documentation on that site.

See you on the other side (that is, the pull request side)!

Resolving patch:
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
--- 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,
     )
 


Test patch:
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -649,6 +649,8 @@ def get_confirmation_url_from_outbox(
         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 @@ def get_confirmation_url_from_outbox(
             ):
                 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
--- a/zerver/tests/test_signup.py
+++ b/zerver/tests/test_signup.py
@@ -2769,8 +2769,13 @@ def check_able_to_create_realm(self, email: str, password: str = "test") -> None
         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)