feat: account dispute emails

This commit is contained in:
2026-09-10 13:21:04 +00:00
parent 5c87505820
commit 50ab63ff13
12 changed files with 210 additions and 2 deletions
+6 -2
View File
@@ -69,17 +69,21 @@ func perRender(hq, tone string) map[string]any {
// The subject comes from the text set, not the HTML one: html/template would
// escape an ampersand in an instance name into "&" and mail clients show
// subjects verbatim.
func render(name string, data any, hq string) (message, error) {
func render(name string, data any, hq ...string) (message, error) {
s, ok := sets[name]
if !ok {
return message{}, fmt.Errorf("no such template")
}
var hqURL string
if len(hq) > 0 {
hqURL = hq[0]
}
var tone strings.Builder
if err := s.text.ExecuteTemplate(&tone, "tone", data); err != nil {
return message{}, err
}
per := perRender(hq, strings.TrimSpace(tone.String()))
per := perRender(hqURL, strings.TrimSpace(tone.String()))
ht, err := s.html.Clone()
if err != nil {