feat(postcard): mail branding and the logo URL

- Brand, DefaultBrand and CompileBrandCSS: thirteen colours, each checked
  as a six-digit hex colour, compiled into CSS for plain elements and the
  built-in layouts and partials
- once the branding row exists its compiled CSS replaces mail.brandCss;
  mail.css still follows, and the file version sent after a failing
  override keeps the Branding
- layouts get logoUrl, built per send from storage.uploads.public_url or
  app.url through attach.AbsolutePublicURL; a logo that cannot be shown is
  left out with a rate-limited warning
- Editor previews and validates a Branding draft (rule colour)

Plan 35-01, task 5.
This commit is contained in:
Jakub Zych
2026-11-13 11:06:43 +01:00
parent 935e4bf64f
commit 2bf9081c1b
10 changed files with 974 additions and 27 deletions

View File

@@ -465,6 +465,8 @@ func parseHeader(header string) (fields, samples map[string]string, err error) {
type renderOptions struct {
css string
brandCSS string
// logoURL is the Branding logo's absolute URL, or empty.
logoURL string
// overrides are the database overrides to apply; the zero value renders
// the file version.
overrides Overrides
@@ -615,6 +617,7 @@ func (c *Catalog) renderParts(msg Message, src renderSource, opts renderOptions)
"Subject": subject,
"css": css,
"brandCss": opts.brandCSS,
"logoUrl": opts.logoURL,
}, texttemplate.FuncMap{"partial": partials.textCall})
if err != nil {
return out, partLayoutText, err
@@ -624,6 +627,7 @@ func (c *Catalog) renderParts(msg Message, src renderSource, opts renderOptions)
"Subject": subject,
"css": template.CSS(css),
"brandCss": template.CSS(opts.brandCSS),
"logoUrl": opts.logoURL,
}, template.FuncMap{"partial": partials.htmlCall})
if err != nil {
return out, partLayoutHTML, err