From 25a8d3807e8846638d7166362f195797dfe1bef9 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Fri, 16 Jul 2021 19:46:05 +0100 Subject: [PATCH] announcements: {{ .username }} --- email.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/email.go b/email.go index 29bf260..c0716fd 100644 --- a/email.go +++ b/email.go @@ -348,12 +348,16 @@ func (emailer *Emailer) constructTemplate(subject, md string, app *appContext, u text := stripMarkdown(md) message := app.config.Section("messages").Key("message").String() var err error - email.HTML, email.Text, email.Markdown, err = emailer.construct(app, "template_email", "email_", map[string]interface{}{ + data := map[string]interface{}{ "text": template.HTML(html), "plaintext": text, "message": message, "md": md, - }) + } + if len(username) != 0 { + data["username"] = username + } + email.HTML, email.Text, email.Markdown, err = emailer.construct(app, "template_email", "email_", data) if err != nil { return nil, err }