Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

emails: Use macros for email tags in invitation email.

Vishnu KSeb008fc864df
diff --git a/scripts/setup/inline_email_css.py b/scripts/setup/inline_email_css.py
index 418ff150f45..c5bfb6c7127 100755
--- a/scripts/setup/inline_email_css.py
+++ b/scripts/setup/inline_email_css.py
@@ -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
diff --git a/templates/zerver/emails/email_base_default.source.html b/templates/zerver/emails/email_base_default.source.html
index a3f0a45d70e..b79eaf88063 100644
--- a/templates/zerver/emails/email_base_default.source.html
+++ b/templates/zerver/emails/email_base_default.source.html
@@ -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>
diff --git a/templates/zerver/emails/invitation.source.html b/templates/zerver/emails/invitation.source.html
index 158bec2b665..cb3a54284d9 100644
--- a/templates/zerver/emails/invitation.source.html
+++ b/templates/zerver/emails/invitation.source.html
@@ -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 %}
diff --git a/templates/zerver/emails/macros.source.html b/templates/zerver/emails/macros.source.html
new file mode 100644
index 00000000000..7859d6563aa
--- /dev/null
+++ b/templates/zerver/emails/macros.source.html
@@ -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 %}