From 39d7fdbbbcf9788fedbb79458343edc50271c4f1 Mon Sep 17 00:00:00 2001 From: Alexander Weaver Date: Tue, 19 Jul 2022 11:05:50 -0500 Subject: [PATCH] Alerting: Preserve new-lines from custom email templates in rendered email (#52253) * Add line break, regenerate, and fix * Left-align custom text in addition to preserving newlines --- emails/templates/layouts/default.txt | 2 +- emails/templates/ng_alert_notification.html | 17 +++++++++++- public/emails/alert_notification.html | 14 +++++----- public/emails/invited_to_org.html | 12 ++++----- public/emails/new_user_invite.html | 11 ++++---- public/emails/ng_alert_notification.html | 29 +++++++++++---------- public/emails/reset_password.html | 4 +-- public/emails/signup_started.html | 10 +++---- public/emails/welcome_on_signup.html | 4 +-- 9 files changed, 60 insertions(+), 43 deletions(-) diff --git a/emails/templates/layouts/default.txt b/emails/templates/layouts/default.txt index 1a323c772d3..543f4ac140d 100644 --- a/emails/templates/layouts/default.txt +++ b/emails/templates/layouts/default.txt @@ -1,3 +1,3 @@ {{> body }} -Sent by Grafana v[[.BuildVersion]] (c) 2021 Grafana Labs \ No newline at end of file +Sent by Grafana v[[.BuildVersion]] (c) 2022 Grafana Labs \ No newline at end of file diff --git a/emails/templates/ng_alert_notification.html b/emails/templates/ng_alert_notification.html index b7c7f6156dd..f97757e7869 100644 --- a/emails/templates/ng_alert_notification.html +++ b/emails/templates/ng_alert_notification.html @@ -4,6 +4,21 @@ [[Subject .Subject "[[.Title]]"]] [[ define "alert" ]] + + [[ if ne .ImageURL "" ]] + + + Alerting Panel + + + [[ end ]] + [[ if ne .EmbeddedImage "" ]] + + + Alerting Chart Attached Below + + + [[ end ]] Value: [[ .ValueString ]] @@ -101,7 +116,7 @@ [[ end ]] [[ if gt (len .Message) 0 ]] - [[ .Message ]] +
[[ .Message ]] [[ else ]]