2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/spec/lib/email
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
..
authentication_results_spec.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
cleaner_spec.rb FIX: Email::Cleaner must clear the encoding of replaced bodies 2026-01-15 13:05:25 -05:00
email_spec.rb
message_builder_spec.rb FEATURE: Add recipient_username interpolation key for email templates (#38096) 2026-02-27 17:18:02 +01:00
processor_spec.rb FIX: email to a category should not require enabling reply-by-email (#37227) 2026-02-03 13:01:16 -05:00
receiver_spec.rb FIX: email to a category should not require enabling reply-by-email (#37227) 2026-02-03 13:01:16 -05:00
renderer_spec.rb DEV: Reset DiscoursePluginRegistry after spec (#25369) 2024-01-22 08:51:36 -06:00
sender_spec.rb FIX: Extract readable string from Net::SMTP::Response in error logs 2026-01-07 14:33:07 +00:00
styles_spec.rb DEV: Preserve ids/classes in emails (#32084) 2025-03-31 20:58:45 +01:00