From 938ee392a3f9c206ef76715d5e5f065a322d00a7 Mon Sep 17 00:00:00 2001 From: Bastian Beier Date: Thu, 16 Jan 2025 13:32:56 +0100 Subject: [PATCH] fix: Email templates to not contain white spaces / new lines if .CallToAction is nil (cherry picked from commit 0c84fe8b36ea5be0067e7ed8624e6696399da1fc) --- changelog/unreleased/fix-email-templates.md | 5 +++++ .../notifications/pkg/email/templates/html/email.html.tmpl | 6 ++++-- .../notifications/pkg/email/templates/text/email.text.tmpl | 6 ++++-- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/fix-email-templates.md diff --git a/changelog/unreleased/fix-email-templates.md b/changelog/unreleased/fix-email-templates.md new file mode 100644 index 00000000000..614fafc30b8 --- /dev/null +++ b/changelog/unreleased/fix-email-templates.md @@ -0,0 +1,5 @@ +Bugfix: Fix email templates white spaces & new lines + +Email templates now contain no unwanted white spaces & new lines if .CallToAction is nil + +https://github.com/owncloud/ocis/pull/10884 diff --git a/services/notifications/pkg/email/templates/html/email.html.tmpl b/services/notifications/pkg/email/templates/html/email.html.tmpl index f36f0766693..92c6f48715e 100644 --- a/services/notifications/pkg/email/templates/html/email.html.tmpl +++ b/services/notifications/pkg/email/templates/html/email.html.tmpl @@ -11,8 +11,10 @@ {{ .Greeting }}

{{ .MessageBody }} - {{if ne .CallToAction "" }}

- {{ .CallToAction }}{{end}} + {{- if .CallToAction }} +

+ {{ .CallToAction }} + {{- end }} diff --git a/services/notifications/pkg/email/templates/text/email.text.tmpl b/services/notifications/pkg/email/templates/text/email.text.tmpl index b571692672d..609117d58fd 100644 --- a/services/notifications/pkg/email/templates/text/email.text.tmpl +++ b/services/notifications/pkg/email/templates/text/email.text.tmpl @@ -1,9 +1,11 @@ {{ .Greeting }} {{ .MessageBody }} -{{if ne .CallToAction "" }} +{{- if .CallToAction }} + {{ .CallToAction }} -{{end}} +{{- end }} + --- ownCloud - Store. Share. Work.