From 2209deb0bfb0174fc4c90318dd203fd46f7a8793 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 16 Jun 2023 05:54:30 -0400 Subject: [PATCH] [v10.0.x] Alerting: Fix newlines in text/plain template (#70228) Alerting: Fix newlines in text/plain template (#70207) Alerting: Fix newlines in text/plain template at last (cherry picked from commit a773b722b1684ec6cbbb6a73550f7c6650573dce) Co-authored-by: George Robinson --- emails/templates/ng_alert_notification.txt | 6 +++--- public/emails/ng_alert_notification.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/emails/templates/ng_alert_notification.txt b/emails/templates/ng_alert_notification.txt index 7bc954243c8..0848d168041 100644 --- a/emails/templates/ng_alert_notification.txt +++ b/emails/templates/ng_alert_notification.txt @@ -7,7 +7,7 @@ You have [[ len .Alerts.Firing ]] firing alert(s), and [[ len .Alerts.Resolved ] [[ template "__default_alerts_summarize" .Alerts.Firing ]] [[- end ]] -[[ if .Alerts.Resolved -]] +[[- if .Alerts.Resolved ]] ([[ len .Alerts.Resolved ]]) RESOLVED ------------- [[ template "__default_alerts_summarize" .Alerts.Resolved ]] @@ -51,12 +51,12 @@ Annotations: [[ template "__default_sorted_pairs" $annotations ]] [[- define "__default_sorted_pairs" -]] [[ range .SortedPairs ]] - [[ .Name ]] = [[ .Value ]] + - [[ .Name ]] = [[ .Value ]] [[- end ]] [[- end -]] [[- if .Message -]] [[ .Message ]] -[[ else -]] +[[- else -]] [[ template "__default_message" . ]] [[- end ]] diff --git a/public/emails/ng_alert_notification.txt b/public/emails/ng_alert_notification.txt index 7334f08f5e8..7db5996f3db 100644 --- a/public/emails/ng_alert_notification.txt +++ b/public/emails/ng_alert_notification.txt @@ -7,7 +7,7 @@ You have {{ len .Alerts.Firing }} firing alert(s), and {{ len .Alerts.Resolved } {{ template "__default_alerts_summarize" .Alerts.Firing }} {{- end }} -{{ if .Alerts.Resolved -}} +{{- if .Alerts.Resolved }} ({{ len .Alerts.Resolved }}) RESOLVED ------------- {{ template "__default_alerts_summarize" .Alerts.Resolved }} @@ -51,13 +51,13 @@ Annotations: {{ template "__default_sorted_pairs" $annotations }} {{- define "__default_sorted_pairs" -}} {{ range .SortedPairs }} - {{ .Name }} = {{ .Value }} + - {{ .Name }} = {{ .Value }} {{- end }} {{- end -}} {{- if .Message -}} {{ .Message }} -{{ else -}} +{{- else -}} {{ template "__default_message" . }} {{- end }}