feat(postcard): database overrides for mail templates with file fallback

- postcard owns the system_mail_* tables (postcard.Migrations), run by lagoon
  as the framework set summercms.postcard after system_files
- Send asks an OverrideSource once per message; NewDBSource reads the
  customized template row through the *gorm.DB published on the app
- a failed lookup, missing tables or an override that does not render or
  fails the safety checks sends the file version and is logged
- the caller's Message.Subject still wins; Mailer, Message, NewMailer,
  Catalog.Register and BootPlugin keep their signatures

Plan 35-01, task 2 (tracer).
This commit is contained in:
Jakub Zych
2026-11-13 10:26:10 +01:00
parent 3198bbe1aa
commit 7e5d2c74af
10 changed files with 932 additions and 30 deletions

View File

@@ -346,7 +346,7 @@ func TestMigrateStatusJSON(t *testing.T) {
for _, line := range strings.Split(strings.TrimSpace(out), "\n")[1:] {
sets = append(sets, strings.Fields(line)[0])
}
wantSets := []string{"summercms.attach", "summercms.cabana", DeferredHistoryID, QueueHistoryID, "demo.alpha", "demo.beta"}
wantSets := []string{"summercms.attach", "summercms.postcard", "summercms.cabana", DeferredHistoryID, QueueHistoryID, "demo.alpha", "demo.beta"}
if !slices.Equal(sets, wantSets) {
t.Errorf("migrate:status sets = %q, want %q:\n%s", sets, wantSets, out)
}