emails: Use macros for email tags in invitation email.

This commit is contained in:
Vishnu KS 2020-10-23 19:00:13 +05:30 committed by Tim Abbott
parent b98434682e
commit eb008fc864
4 changed files with 12 additions and 3 deletions

View File

@ -50,7 +50,7 @@ def inline_template(template_source_name: str) -> None:
# template, since we'll end up with 2 copipes of those tags.
# Thus, we strip this stuff out if the template extends
# another template.
if template_name != 'email_base_default':
if template_name not in ['email_base_default', 'macros']:
output = strip_unnecesary_tags(output)
if ('zerver/emails/compiled/email_base_default.html' in output or

View File

@ -1,3 +1,4 @@
{% import 'zerver/emails/compiled/macros.html' as macros %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>

View File

@ -5,16 +5,17 @@
{% endblock %}
{% block content %}
<p>{{ _("Hi there,") }}</p>
<p>
{% trans %}<a href="mailto:{{ referrer_email }}">{{ referrer_full_name }} ({{ referrer_email }})</a> wants you to join them on Zulip &mdash; the team communication tool designed for productivity.{% endtrans %}
{% trans referrer_name=macros.referrer_email_tag(referrer_email, referrer_full_name) %}{{ referrer_name }} wants you to join them on Zulip &mdash; the team communication tool designed for productivity.{% endtrans %}
</p>
<p>
{{ _("To get started, click the button below.") }}
<a class="button" href="{{ activate_url }}">{{ _("Complete registration") }}</a>
</p>
<p>
{% trans %}Contact us any time at <a href="mailto:{{ support_email }}">{{ support_email }}</a> if you run into trouble, have any feedback, or just want to chat!{% endtrans %}
{% 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 %}
</p>
{% endblock %}

View File

@ -0,0 +1,7 @@
{% macro email_tag(email, text) -%}
<a href="mailto:{{ email }}">{{ text | default(email) }}</a>
{%- endmacro %}
{% macro referrer_email_tag(referrer_email, referrer_name) -%}
<a href="mailto:{{ referrer_email }}">{{ referrer_name }} ({{ referrer_email }})</a>
{%- endmacro %}