2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 22:05:52 +08:00
discourse/spec/mailers
Régis Hanol 3e5727b76b
FEATURE: Add recipient_username interpolation key for email templates (#38096)
Admins customizing email templates had no way to reference the username
of the person receiving the email. The existing `%{username}` key refers
to the post author, not the recipient.

Pass the recipient user object through `build_email` via a new
`recipient_user` option across all mailer paths (notifications, account
emails, digest, token-based emails). `Email::MessageBuilder` then
extracts `recipient_username` into template args when present. The key
is also added to `ALLOWED_CUSTOM_INTERPOLATION_KEYS` so it appears in
the admin email template editor and passes validation.

Not available for invite emails since the recipient has no account yet.

Ref - t/172375
2026-02-27 17:18:02 +01:00
..
group_smtp_mailer_spec.rb DEV: Remove IMAP support in Discourse (#37002) 2026-01-12 10:07:26 +10:00
invite_mailer_spec.rb DEV: fix flaky invite_mailer_spec test (#35664) 2025-10-29 11:14:36 -04:00
rejection_mailer_spec.rb DEV: Update rubocop-discourse to latest version 2024-03-04 15:08:35 +01:00
subscription_mailer_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
test_mailer_spec.rb
user_notifications_spec.rb FEATURE: Add recipient_username interpolation key for email templates (#38096) 2026-02-27 17:18:02 +01:00
version_mailer_spec.rb