fix(mail): German spacing for invoice draft template
Separate paragraphs with blank lines; mailbox signature uses Synapse MXID.
This commit is contained in:
+5
-2
@@ -254,16 +254,19 @@ für das Service package (OS image inkl. Backup, Monitoring, RustDesk,
|
|||||||
gemeinsamem Datenträger und Netzwerkzugriff).
|
gemeinsamem Datenträger und Netzwerkzugriff).
|
||||||
|
|
||||||
Zahlungsziel: 14 Tage netto.
|
Zahlungsziel: 14 Tage netto.
|
||||||
Steuerhinweis: siehe Notizen auf der Rechnung (Reverse Charge / § 13b UStG).
|
|
||||||
|
Steuerhinweis: siehe Notizen auf der Rechnung
|
||||||
|
(Reverse Charge / § 13b UStG).
|
||||||
|
|
||||||
Mit freundlichen Grüßen
|
Mit freundlichen Grüßen
|
||||||
|
|
||||||
Example Author`, number, cost)
|
Example Author`, number, cost)
|
||||||
}
|
}
|
||||||
draft, err := c.SaveMailDraft(cmd.Context(), onlyoffice.SaveMailDraftParams{
|
draft, err := c.SaveMailDraft(cmd.Context(), onlyoffice.SaveMailDraftParams{
|
||||||
From: from,
|
From: from,
|
||||||
To: to,
|
To: to,
|
||||||
Subject: subject,
|
Subject: subject,
|
||||||
Body: onlyoffice.PlainTextToMailHTML(body),
|
Body: onlyoffice.MailHTMLWithBlankParagraphs(onlyoffice.PlainTextToMailHTML(body)),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -231,6 +231,16 @@ func PlainTextToMailHTML(s string) string {
|
|||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MailHTMLWithBlankParagraphs inserts empty paragraphs between blocks
|
||||||
|
// (German Geschäftsbrief-style vertical spacing in OnlyOffice Mail).
|
||||||
|
func MailHTMLWithBlankParagraphs(html string) string {
|
||||||
|
html = strings.TrimSpace(html)
|
||||||
|
if html == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return strings.ReplaceAll(html, "</p>\n<p>", "</p>\n<p> </p>\n<p>")
|
||||||
|
}
|
||||||
|
|
||||||
// Int64FromMap coerces OnlyOffice numeric id fields (float64/int/string) to int64.
|
// Int64FromMap coerces OnlyOffice numeric id fields (float64/int/string) to int64.
|
||||||
func Int64FromMap(m map[string]any, key string) int64 {
|
func Int64FromMap(m map[string]any, key string) int64 {
|
||||||
switch v := m[key].(type) {
|
switch v := m[key].(type) {
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ func TestPlainTextToMailHTML(t *testing.T) {
|
|||||||
if PlainTextToMailHTML(html) != html {
|
if PlainTextToMailHTML(html) != html {
|
||||||
t.Fatalf("html passthrough failed")
|
t.Fatalf("html passthrough failed")
|
||||||
}
|
}
|
||||||
|
spaced := MailHTMLWithBlankParagraphs("<p>A</p>\n<p>B</p>")
|
||||||
|
if spaced != "<p>A</p>\n<p> </p>\n<p>B</p>" {
|
||||||
|
t.Fatalf("spaced: %q", spaced)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInt64FromMap(t *testing.T) {
|
func TestInt64FromMap(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user