diff --git a/docs/subsystems/email.md b/docs/subsystems/email.md index 5377290a34..88e3bb1e8f 100644 --- a/docs/subsystems/email.md +++ b/docs/subsystems/email.md @@ -12,7 +12,7 @@ On to the documentation. Zulip's email system is fairly straightforward, with only a few things you need to know to get started. * All email templates are in `templates/zerver/emails/`. Each email has three - template files: `.subject`, `.txt`, and + template files: `.subject.txt`, `.txt`, and `.source.html`. Email templates, along with all other templates in the `templates/` directory, are Jinja2 templates. * Most of the CSS and HTML layout for emails is in `email_base.html`. Note diff --git a/templates/zerver/emails/confirm_new_email.subject b/templates/zerver/emails/confirm_new_email.subject.txt similarity index 100% rename from templates/zerver/emails/confirm_new_email.subject rename to templates/zerver/emails/confirm_new_email.subject.txt diff --git a/templates/zerver/emails/confirm_registration.subject b/templates/zerver/emails/confirm_registration.subject.txt similarity index 100% rename from templates/zerver/emails/confirm_registration.subject rename to templates/zerver/emails/confirm_registration.subject.txt diff --git a/templates/zerver/emails/digest.subject b/templates/zerver/emails/digest.subject.txt similarity index 100% rename from templates/zerver/emails/digest.subject rename to templates/zerver/emails/digest.subject.txt diff --git a/templates/zerver/emails/find_team.subject b/templates/zerver/emails/find_team.subject.txt similarity index 100% rename from templates/zerver/emails/find_team.subject rename to templates/zerver/emails/find_team.subject.txt diff --git a/templates/zerver/emails/followup_day1.subject b/templates/zerver/emails/followup_day1.subject.txt similarity index 100% rename from templates/zerver/emails/followup_day1.subject rename to templates/zerver/emails/followup_day1.subject.txt diff --git a/templates/zerver/emails/followup_day2.subject b/templates/zerver/emails/followup_day2.subject.txt similarity index 100% rename from templates/zerver/emails/followup_day2.subject rename to templates/zerver/emails/followup_day2.subject.txt diff --git a/templates/zerver/emails/invitation.subject b/templates/zerver/emails/invitation.subject.txt similarity index 100% rename from templates/zerver/emails/invitation.subject rename to templates/zerver/emails/invitation.subject.txt diff --git a/templates/zerver/emails/invitation_reminder.subject b/templates/zerver/emails/invitation_reminder.subject.txt similarity index 100% rename from templates/zerver/emails/invitation_reminder.subject rename to templates/zerver/emails/invitation_reminder.subject.txt diff --git a/templates/zerver/emails/missed_message.subject b/templates/zerver/emails/missed_message.subject.txt similarity index 100% rename from templates/zerver/emails/missed_message.subject rename to templates/zerver/emails/missed_message.subject.txt diff --git a/templates/zerver/emails/notify_change_in_email.subject b/templates/zerver/emails/notify_change_in_email.subject.txt similarity index 100% rename from templates/zerver/emails/notify_change_in_email.subject rename to templates/zerver/emails/notify_change_in_email.subject.txt diff --git a/templates/zerver/emails/notify_new_login.subject b/templates/zerver/emails/notify_new_login.subject.txt similarity index 100% rename from templates/zerver/emails/notify_new_login.subject rename to templates/zerver/emails/notify_new_login.subject.txt diff --git a/templates/zerver/emails/password_reset.subject b/templates/zerver/emails/password_reset.subject.txt similarity index 100% rename from templates/zerver/emails/password_reset.subject rename to templates/zerver/emails/password_reset.subject.txt diff --git a/templates/zerver/emails/realm_reactivation.subject b/templates/zerver/emails/realm_reactivation.subject.txt similarity index 100% rename from templates/zerver/emails/realm_reactivation.subject rename to templates/zerver/emails/realm_reactivation.subject.txt diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py index 6f092ac183..7f4a5193e7 100644 --- a/zerver/lib/send_email.py +++ b/zerver/lib/send_email.py @@ -57,7 +57,7 @@ def build_email(template_prefix: str, to_user_ids: Optional[List[int]]=None, }) def render_templates() -> Tuple[str, str, str]: - subject = loader.render_to_string(template_prefix + '.subject', + subject = loader.render_to_string(template_prefix + '.subject.txt', context=context, using='Jinja2_plaintext').strip().replace('\n', '') message = loader.render_to_string(template_prefix + '.txt', diff --git a/zerver/tests/test_templates.py b/zerver/tests/test_templates.py index 4baf25a79f..f24de3ce4d 100644 --- a/zerver/tests/test_templates.py +++ b/zerver/tests/test_templates.py @@ -83,18 +83,18 @@ class TemplateTestCase(ZulipTestCase): 'zerver/delete_message.html', ] unusual = [ - 'zerver/emails/confirm_new_email.subject', + 'zerver/emails/confirm_new_email.subject.txt', 'zerver/emails/compiled/confirm_new_email.html', 'zerver/emails/confirm_new_email.txt', - 'zerver/emails/notify_change_in_email.subject', + 'zerver/emails/notify_change_in_email.subject.txt', 'zerver/emails/compiled/notify_change_in_email.html', - 'zerver/emails/digest.subject', + 'zerver/emails/digest.subject.txt', 'zerver/emails/digest.html', 'zerver/emails/digest.txt', - 'zerver/emails/followup_day1.subject', + 'zerver/emails/followup_day1.subject.txt', 'zerver/emails/compiled/followup_day1.html', 'zerver/emails/followup_day1.txt', - 'zerver/emails/followup_day2.subject', + 'zerver/emails/followup_day2.subject.txt', 'zerver/emails/followup_day2.txt', 'zerver/emails/compiled/followup_day2.html', 'zerver/emails/compiled/password_reset.html',