feat(quick-261115-cha): let a mail template use another plugin's layout by full code

- resolveLayoutLocked: after the plugin's own alias and the built-in
  aliases, a full layout name already in the catalog resolves to itself;
  an unregistered full name fails with a require-the-owner hint
- another plugin's short alias and the short-alias error are unchanged
- TestCrossPluginLayout covers register, send, errors and precedence
- postcard README and docs/services/mail.md describe the rule
This commit is contained in:
Jakub Zych
2026-11-15 09:08:21 +01:00
parent 42ab223e79
commit 1fb4254291
5 changed files with 214 additions and 7 deletions

View File

@@ -368,7 +368,7 @@ func loggerFromApp(app *backpack.App) *slog.Logger {
// BootPlugin registers a plugin's declared mail partials (pact.HasMailPartials)
// and its templates and layouts (pact.HasMailTemplates). Either capability is
// optional. Missing files, duplicates, names outside the plugin's namespace
// and unknown layout aliases fail with the dotted name.
// and unknown layouts (aliases or full layout names) fail with the dotted name.
func BootPlugin[P interface{ ID() string }](app *backpack.App, p P) error {
hm, hasTemplates := any(p).(pact.HasMailTemplates)
hp, hasPartials := any(p).(pact.HasMailPartials)