email-templates: Add account_registered email templates.

The "followup_day1" email template name is not clear or descriptive
about the purpose of the email. Creates a duplicate of those email
template files with the template name "account_registered".

Because any existing scheduled emails that use the "followup_day1"
templates will need to be updated before the current templates can
be removed, we don't do a simple file rename here.
This commit is contained in:
Lauryn Menard 2023-07-18 11:44:27 +02:00 committed by Tim Abbott
parent 170a857bc1
commit c491bef07b
7 changed files with 127 additions and 9 deletions

View File

@ -0,0 +1,62 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
{% if realm_creation %}
{% if is_demo_org %}
<p>
{% trans demo_organizations_help_link="https://zulip.com/help/demo-organizations" %}Congratulations, you have created a new Zulip demo organization. Note
that this organization will be automatically deleted in 30 days. Learn more
about demo organizations <a
href="{{ demo_organizations_help_link }}">here</a>!
{% endtrans %}
</p>
{% else %}
<p>
{% trans %}Congratulations, you have created a new Zulip
organization: <b>{{ realm_name }}</b>.{% endtrans %}
</p>
{% endif %}
{% else %}
<p>{{ _('Welcome to Zulip!') }}</p>
<p>
{% trans %}You've joined the Zulip organization <b>{{ realm_name }}</b>.
{% endtrans %}
</p>
{% endif %}
<p>
{% trans apps_page_link="https://zulip.com/apps/" %}You will use the following info to log into the Zulip web, <a href="{{ apps_page_link }}">mobile and desktop</a> apps:{% endtrans %}
<ul>
<li>{% trans organization_url=macros.link_tag(realm_uri) %}Organization URL: {{ organization_url }}{% endtrans %}<br /></li>
{% if ldap %}
{% if ldap_username %}
<li>{% trans %}Your username: {{ ldap_username }}{% endtrans %}<br /></li>
{% else %}
<li>{{ _('Use your LDAP account to log in') }}<br /></li>
{% endif %}
{% else %}
<li>{% trans email=macros.email_tag(email) %}Your account email: {{ email }}{% endtrans %}<br /></li>
{% endif %}
</ul>
<a class="button" href="{{ realm_uri }}">{{ _('Go to organization') }}</a>
</p>
<p>
{% trans %}If you are new to Zulip, check out our <a href="{{ getting_user_started_link }}">Getting started guide</a>!{% endtrans %}
{% if is_realm_admin %}
{% trans %}We also have a guide for <a href="{{ getting_organization_started_link }}">Setting up your organization</a>.{% endtrans %}
{% endif %}
</p>
<p>
{% if corporate_enabled %}
{% trans %}Questions? <a href="{{ support_email }}">Contact us</a> — we'd love to help!{% endtrans %}
{% else %}
{{macros.contact_us_self_hosted(support_email)}}
{% endif %}
</p>
{% endblock %}

View File

@ -0,0 +1,9 @@
{% if realm_creation %}
{% trans -%}
{{ realm_name }} on Zulip: Your new organization details
{%- endtrans %}
{% else %}
{% trans -%}
{{ realm_name }} on Zulip: Your new account details
{%- endtrans %}
{% endif %}

View File

@ -0,0 +1,39 @@
{{ _('Welcome to Zulip!') }}
{% if realm_creation %}
{% if is_demo_org %}
{% trans demo_organizations_help_link="https://zulip.com/help/demo-organizations" %} Congratulations, you have created a new demo Zulip organization. Note that this organization will be automatically deleted in 30 days. Learn more about demo organizations here: {{ demo_organizations_help_link }}!{% endtrans %}
{% else %}
{% trans %}Congratulations, you have created a new Zulip organization: {{ realm_name }}.{% endtrans %}
{% endif %}
{% else %}
{% trans %}You've joined the Zulip organization {{ realm_name }}.{% endtrans %}
{% endif %}
{% trans apps_page_link="https://zulip.com/apps/" %}You will use the following info to log into the Zulip web, mobile and desktop apps ({{ apps_page_link}}):{% endtrans %}
* {% trans organization_url=realm_uri %}Organization URL: {{ organization_url }}{% endtrans %}
{% if ldap %}
{% if ldap_username %}
* {% trans %}Your username: {{ ldap_username }}{% endtrans %}
{% else %}
* {{ _('Use your LDAP account to log in') }}
{% endif %}
{% else %}
* {% trans %}Your account email: {{ email }}{% endtrans %}
{% endif %}
{% trans %}If you are new to Zulip, check out our Getting started guide ({{ getting_user_started_link }})!{% endtrans %}
{% if is_realm_admin %}
{% trans %} We also have a guide for Setting up your organization ({{ getting_organization_started_link }}).{% endtrans %}
{% endif %}
{% if corporate_enabled %}
{% trans %}Questions? Contact us at {{ support_email }} — we'd love to help!{% endtrans %}
{% else %}
{% trans %}If you have any questions, please contact this Zulip server's administrators at {{ support_email }}.{% endtrans %}
{% endif %}

View File

@ -802,7 +802,7 @@ def send_account_registered_email(user: UserProfile, realm_creation: bool = Fals
break break
send_future_email( send_future_email(
"zerver/emails/followup_day1", "zerver/emails/account_registered",
user.realm, user.realm,
to_user_ids=[user.id], to_user_ids=[user.id],
from_name=from_name, from_name=from_name,

View File

@ -4422,6 +4422,7 @@ class ScheduledMessage(models.Model):
EMAIL_TYPES = { EMAIL_TYPES = {
"account_registered": ScheduledEmail.WELCOME,
"followup_day1": ScheduledEmail.WELCOME, "followup_day1": ScheduledEmail.WELCOME,
"followup_day2": ScheduledEmail.WELCOME, "followup_day2": ScheduledEmail.WELCOME,
"onboarding_zulip_guide": ScheduledEmail.WELCOME, "onboarding_zulip_guide": ScheduledEmail.WELCOME,

View File

@ -382,7 +382,8 @@ class TestFollowupEmails(ZulipTestCase):
) )
self.assert_length(scheduled_emails, 3) self.assert_length(scheduled_emails, 3)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[1].data)["template_prefix"], "zerver/emails/followup_day2" orjson.loads(scheduled_emails[1].data)["template_prefix"], "zerver/emails/followup_day2"
@ -407,7 +408,8 @@ class TestFollowupEmails(ZulipTestCase):
) )
self.assert_length(scheduled_emails, 2) self.assert_length(scheduled_emails, 2)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[1].data)["template_prefix"], "zerver/emails/followup_day2" orjson.loads(scheduled_emails[1].data)["template_prefix"], "zerver/emails/followup_day2"
@ -421,7 +423,8 @@ class TestFollowupEmails(ZulipTestCase):
scheduled_emails = ScheduledEmail.objects.filter(users=iago).order_by("scheduled_timestamp") scheduled_emails = ScheduledEmail.objects.filter(users=iago).order_by("scheduled_timestamp")
self.assert_length(scheduled_emails, 3) self.assert_length(scheduled_emails, 3)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[1].data)["template_prefix"], "zerver/emails/followup_day2" orjson.loads(scheduled_emails[1].data)["template_prefix"], "zerver/emails/followup_day2"
@ -445,7 +448,8 @@ class TestFollowupEmails(ZulipTestCase):
) )
self.assert_length(scheduled_emails, 2) self.assert_length(scheduled_emails, 2)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[1].data)["template_prefix"], orjson.loads(scheduled_emails[1].data)["template_prefix"],
@ -468,7 +472,8 @@ class TestFollowupEmails(ZulipTestCase):
scheduled_emails = ScheduledEmail.objects.filter(users=cordelia) scheduled_emails = ScheduledEmail.objects.filter(users=cordelia)
self.assert_length(scheduled_emails, 1) self.assert_length(scheduled_emails, 1)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
def test_followup_emails_for_regular_realms(self) -> None: def test_followup_emails_for_regular_realms(self) -> None:
@ -481,7 +486,8 @@ class TestFollowupEmails(ZulipTestCase):
assert scheduled_emails is not None assert scheduled_emails is not None
self.assert_length(scheduled_emails, 2) self.assert_length(scheduled_emails, 2)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[1].data)["template_prefix"], orjson.loads(scheduled_emails[1].data)["template_prefix"],
@ -511,7 +517,8 @@ class TestFollowupEmails(ZulipTestCase):
assert scheduled_emails is not None assert scheduled_emails is not None
self.assert_length(scheduled_emails, 2) self.assert_length(scheduled_emails, 2)
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[0].data)["template_prefix"], "zerver/emails/followup_day1" orjson.loads(scheduled_emails[0].data)["template_prefix"],
"zerver/emails/account_registered",
) )
self.assertEqual( self.assertEqual(
orjson.loads(scheduled_emails[1].data)["template_prefix"], orjson.loads(scheduled_emails[1].data)["template_prefix"],

View File

@ -70,7 +70,7 @@ class EmailTranslationTestCase(ZulipTestCase):
with self.settings(DEVELOPMENT_LOG_EMAILS=True): with self.settings(DEVELOPMENT_LOG_EMAILS=True):
enqueue_welcome_emails(hamlet) enqueue_welcome_emails(hamlet)
# TODO: Uncomment and replace with translation once we have German translations for the strings # TODO: Uncomment and replace with translation once we have German translations for the strings
# in followup_day1 emails. # in account_registered emails.
# check_translation("Viele Grüße", "") # check_translation("Viele Grüße", "")