fix(notifications): rendering of plaintext mails
This commit is contained in:
@ -35,12 +35,12 @@ import (
|
||||
const mailTemplatePlain = `
|
||||
{{ .Greeting }}
|
||||
{{ range $line := .IntroLines}}
|
||||
{{ $line }}
|
||||
{{ $line.Text }}
|
||||
{{ end }}
|
||||
{{ if .ActionURL }}{{ .ActionText }}:
|
||||
{{ .ActionURL }}{{end}}
|
||||
{{ range $line := .OutroLines}}
|
||||
{{ $line }}
|
||||
{{ $line.Text }}
|
||||
{{ end }}`
|
||||
|
||||
const mailTemplateHTML = `
|
||||
@ -50,9 +50,9 @@ const mailTemplateHTML = `
|
||||
<meta name="viewport" content="width: display-width;">
|
||||
</head>
|
||||
<body style="width: 100%; padding: 0; margin: 0; background: #f3f4f6">
|
||||
<div style="width: 100%; font-family: 'Open Sans', sans-serif; text-rendering: optimizeLegibility">
|
||||
<div style="width: 600px; margin: 0 auto; text-align: justify;">
|
||||
<h1 style="font-size: 30px; text-align: center;">
|
||||
<div style="width: 100%; font-family: 'Open Sans', sans-serif; Text-rendering: optimizeLegibility">
|
||||
<div style="width: 600px; margin: 0 auto; Text-align: justify;">
|
||||
<h1 style="font-size: 30px; Text-align: center;">
|
||||
<img src="cid:logo.png" style="height: 75px;" alt="Vikunja"/>
|
||||
</h1>
|
||||
<div style="border: 1px solid #dbdbdb; -webkit-box-shadow: 0.3em 0.3em 0.8em #e6e6e6; box-shadow: 0.3em 0.3em 0.8em #e6e6e6; color: #4a4a4a; padding: 5px 25px; border-radius: 3px; background: #fff;">
|
||||
@ -66,7 +66,7 @@ const mailTemplateHTML = `
|
||||
|
||||
{{ if .ActionURL }}
|
||||
<a href="{{ .ActionURL }}" title="{{ .ActionText }}"
|
||||
style="position: relative;text-decoration:none;display: block;border-radius: 4px;cursor: pointer;padding-bottom: 8px;padding-left: 14px;padding-right: 14px;padding-top: 8px;width:280px;margin:10px auto;text-align: center;white-space: nowrap;border: 0;text-transform: uppercase;font-size: 14px;font-weight: 700;-webkit-box-shadow: 0 3px 6px rgba(107,114,128,.12),0 2px 4px rgba(107,114,128,.1);box-shadow: 0 3px 6px rgba(107,114,128,.12),0 2px 4px rgba(107,114,128,.1);background-color: #1973ff;border-color: transparent;color: #fff;">
|
||||
style="position: relative;Text-decoration:none;display: block;border-radius: 4px;cursor: pointer;padding-bottom: 8px;padding-left: 14px;padding-right: 14px;padding-top: 8px;width:280px;margin:10px auto;Text-align: center;white-space: nowrap;border: 0;Text-transform: uppercase;font-size: 14px;font-weight: 700;-webkit-box-shadow: 0 3px 6px rgba(107,114,128,.12),0 2px 4px rgba(107,114,128,.1);box-shadow: 0 3px 6px rgba(107,114,128,.12),0 2px 4px rgba(107,114,128,.1);background-color: #1973ff;border-color: transparent;color: #fff;">
|
||||
{{ .ActionText }}
|
||||
</a>
|
||||
{{end}}
|
||||
@ -125,11 +125,11 @@ func RenderMail(m *Mail) (mailOpts *mail.Opts, err error) {
|
||||
for _, line := range m.introLines {
|
||||
if line.isHTML {
|
||||
// #nosec G203 -- the html is sanitized
|
||||
introLinesHTML = append(introLinesHTML, templatehtml.HTML(p.Sanitize(line.text)))
|
||||
introLinesHTML = append(introLinesHTML, templatehtml.HTML(p.Sanitize(line.Text)))
|
||||
continue
|
||||
}
|
||||
|
||||
md := []byte(templatehtml.HTMLEscapeString(line.text))
|
||||
md := []byte(templatehtml.HTMLEscapeString(line.Text))
|
||||
var buf bytes.Buffer
|
||||
err = goldmark.Convert(md, &buf)
|
||||
if err != nil {
|
||||
@ -144,11 +144,11 @@ func RenderMail(m *Mail) (mailOpts *mail.Opts, err error) {
|
||||
for _, line := range m.outroLines {
|
||||
if line.isHTML {
|
||||
// #nosec G203 -- the html is sanitized
|
||||
outroLinesHTML = append(outroLinesHTML, templatehtml.HTML(p.Sanitize(line.text)))
|
||||
outroLinesHTML = append(outroLinesHTML, templatehtml.HTML(p.Sanitize(line.Text)))
|
||||
continue
|
||||
}
|
||||
|
||||
md := []byte(templatehtml.HTMLEscapeString(line.text))
|
||||
md := []byte(templatehtml.HTMLEscapeString(line.Text))
|
||||
var buf bytes.Buffer
|
||||
err = goldmark.Convert(md, &buf)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user