SMTP: Update email templates to include populated <title> tag (#61430)

* add .TemplateData property to data in order to populate template <title> tags with the compiled subject value

* update all templates

* re-enable integration test and update implementation to check changes

* chore: fmt

* add HiddenSubject template func and update text templates

* slight performance improvement, only execute subject template once

* update template I missed

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
Michael Mandrus
2023-01-30 16:56:23 -05:00
committed by GitHub
parent a92c081a33
commit 8dab3bf36c
30 changed files with 107 additions and 70 deletions

View File

@@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject! Use the HTML comment below ⬇ -->
<mj-title>
{{ Subject .Subject "{{ .InvitedBy }} has added you to the {{ .OrgName }} organization" }}
{{ Subject .Subject .TemplateData "{{ .InvitedBy }} has added you to the {{ .OrgName }} organization" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
</mj-head>

View File

@@ -1,4 +1,4 @@
[[Subject .Subject "[[.InvitedBy]] has added you to the [[.OrgName]] organization"]]
[[HiddenSubject .Subject "[[.InvitedBy]] has added you to the [[.OrgName]] organization"]]
You have been added to [[.OrgName]]

View File

@@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject below! ⬇ -->
<mj-title>
{{ Subject .Subject "{{ .InvitedBy }} has invited you to join Grafana" }}
{{ Subject .Subject .TemplateData "{{ .InvitedBy }} has invited you to join Grafana" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
</mj-head>

View File

@@ -1,4 +1,4 @@
[[Subject .Subject "[[.InvitedBy]] has invited you to join Grafana"]]
[[HiddenSubject .Subject "[[.InvitedBy]] has invited you to join Grafana"]]
You're invited to join [[.OrgName]]

View File

@@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject below! ⬇ -->
<mj-title>
{{ Subject .Subject "{{ .Title }}" }}
{{ Subject .Subject .TemplateData "{{ .Title }}" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
<!-- Summary of the email contents, this will go in the email preview -->

View File

@@ -1,4 +1,4 @@
[[Subject .Subject "[[.Title]]"]]
[[HiddenSubject .Subject "[[.Title]]"]]
[[.Title]]
----------------

View File

@@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject below! ⬇ -->
<mj-title>
{{ Subject .Subject "Reset your Grafana password - {{.Name}}" }}
{{ Subject .Subject .TemplateData "Reset your Grafana password - {{.Name}}" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
</mj-head>

View File

@@ -1,4 +1,4 @@
[[Subject .Subject "Reset your Grafana password - [[.Name]]"]]
[[HiddenSubject .Subject "Reset your Grafana password - [[.Name]]"]]
Hi [[.Name]],

View File

@@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject below! ⬇ -->
<mj-title>
{{ Subject .Subject "Welcome to Grafana, please complete your sign up!" }}
{{ Subject .Subject .TemplateData "Welcome to Grafana, please complete your sign up!" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
</mj-head>

View File

@@ -1,4 +1,4 @@
[[Subject .Subject "Welcome to Grafana, please complete your sign up!"]]
[[HiddenSubject .Subject "Welcome to Grafana, please complete your sign up!"]]
Complete the signup

View File

@@ -2,7 +2,7 @@
<mj-head>
<!-- ⬇ Don't forget to specifify an email subject below! ⬇ -->
<mj-title>
{{ Subject .Subject "Welcome to Grafana" }}
{{ Subject .Subject .TemplateData "Welcome to Grafana" }}
</mj-title>
<mj-include path="./partials/layout/head.mjml" />
</mj-head>

View File

@@ -1,4 +1,4 @@
[[Subject .Subject "Welcome to Grafana"]]
[[HiddenSubject .Subject "Welcome to Grafana"]]
Hi [[.Name]],