You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
✨ Mailer: resolve templates through config.mailer.templates #4129
Add mailer.templates: {} to development.config.js. It maps a key to a relative .html path.
Extract render(key, params, { subject } = {}), which returns the html, and export it. sendMail calls it.
Resolution:
The key goes through path.basename.
A key in the map uses its path.
Any other key falls back to config/templates/<key>.html, which is today's behavior.
Containment: a configured path must be relative, end in .html and resolve (path.relative) inside the project root. Otherwise throw an error that names the key.
Acceptance criteria
Callers are unchanged, and every existing key renders the same HTML as today.
A map entry pointing to config/templates/<project>/x.html wins over the flat file.
Keys not in the map still resolve from the flat folder, so templates that exist only in a downstream keep working.
Absolute paths, paths containing .. that escape the root, and non-.html paths are rejected.
Tests
Resolution order: a map hit, a map miss that falls back, and a key containing a traversal attempt.
Containment: an absolute path, .., and the wrong extension.
Baseline render over all 15 shared templates: each template gets fixture params. Assert that every {{variable}} it references is present in its fixture. Snapshot the normalized text; the fragments slice diffs against this snapshot.
Make the files.readFile mock path-aware.
Depends on: nothing (it can land in parallel with the billing-links fix).
Refs: lib/helpers/mailer/index.js:82-99, lib/helpers/mailer/tests/mailer.unit.tests.js
Activity
PierreBrisorgueil commentedon Oct 2, 2026
WIP — session 20261002T172300Z-5378F1A9, branch feat/4129-mailer-templates-resolver, started 2026-10-02T17:23:00Z
test(mailer): baseline fixture check is subset, not equality
PierreBrisorgueil commentedon Oct 2, 2026
merged via drain (Automerge: absent, --review: false) — PR #4164