From d238272bdbbe5f417c3ec07e5ce39a77a9a97bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leszek=20Cima=C5=82a?= Date: Wed, 8 Jan 2020 21:44:16 +0100 Subject: add .OriginalMIMEType variable to reply template --- lib/templates/template.go | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'lib/templates') diff --git a/lib/templates/template.go b/lib/templates/template.go index 8a345d9..6eae5a2 100644 --- a/lib/templates/template.go +++ b/lib/templates/template.go @@ -22,9 +22,10 @@ type TemplateData struct { Date time.Time Subject string // Only available when replying with a quote - OriginalText string - OriginalFrom []*mail.Address - OriginalDate time.Time + OriginalText string + OriginalFrom []*mail.Address + OriginalDate time.Time + OriginalMIMEType string } func TestTemplateData() TemplateData { @@ -36,9 +37,10 @@ func TestTemplateData() TemplateData { } original := models.OriginalMail{ - Date: time.Now().Format("Mon Jan 2, 2006 at 3:04 PM"), - From: "John Doe ", - Text: "This is only a test text", + Date: time.Now().Format("Mon Jan 2, 2006 at 3:04 PM"), + From: "John Doe ", + Text: "This is only a test text", + MIMEType: "text/plain", } return ParseTemplateData(defaults, original) @@ -47,15 +49,16 @@ func TestTemplateData() TemplateData { func ParseTemplateData(defaults map[string]string, original models.OriginalMail) TemplateData { originalDate, _ := time.Parse("Mon Jan 2, 2006 at 3:04 PM", original.Date) td := TemplateData{ - To: parseAddressList(defaults["To"]), - Cc: parseAddressList(defaults["Cc"]), - Bcc: parseAddressList(defaults["Bcc"]), - From: parseAddressList(defaults["From"]), - Date: time.Now(), - Subject: defaults["Subject"], - OriginalText: original.Text, - OriginalFrom: parseAddressList(original.From), - OriginalDate: originalDate, + To: parseAddressList(defaults["To"]), + Cc: parseAddressList(defaults["Cc"]), + Bcc: parseAddressList(defaults["Bcc"]), + From: parseAddressList(defaults["From"]), + Date: time.Now(), + Subject: defaults["Subject"], + OriginalText: original.Text, + OriginalFrom: parseAddressList(original.From), + OriginalDate: originalDate, + OriginalMIMEType: original.MIMEType, } return td } -- cgit v1.2.3