DEV: Pass recipient email address to message_builder modifiers (#27308)

This commit is contained in:
Mark VanLandingham 2024-06-04 08:00:30 -05:00 committed by GitHub
parent 0ddad8fc64
commit d42a1c8885
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,12 +28,14 @@ module Email
:message_builder_visit_link_to_respond, :message_builder_visit_link_to_respond,
"user_notifications.visit_link_to_respond", "user_notifications.visit_link_to_respond",
@opts, @opts,
@to,
) )
@reply_by_email_key = @reply_by_email_key =
DiscoursePluginRegistry.apply_modifier( DiscoursePluginRegistry.apply_modifier(
:message_builder_reply_by_email, :message_builder_reply_by_email,
"user_notifications.reply_by_email", "user_notifications.reply_by_email",
@opts, @opts,
@to,
) )
if @opts[:include_respond_instructions] == false if @opts[:include_respond_instructions] == false
@ -136,7 +138,7 @@ module Email
else else
subject = @opts[:subject] subject = @opts[:subject]
end end
DiscoursePluginRegistry.apply_modifier(:message_builder_subject, subject, @opts) DiscoursePluginRegistry.apply_modifier(:message_builder_subject, subject, @opts, @to)
end end
def html_part def html_part
@ -174,7 +176,7 @@ module Email
html_body: html_override.html_safe, html_body: html_override.html_safe,
}, },
) )
html = DiscoursePluginRegistry.apply_modifier(:message_builder_html_part, html, @opts) html = DiscoursePluginRegistry.apply_modifier(:message_builder_html_part, html, @opts, @to)
Mail::Part.new do Mail::Part.new do
content_type "text/html; charset=UTF-8" content_type "text/html; charset=UTF-8"
@ -195,7 +197,7 @@ module Email
body << "\n" body << "\n"
body << @template_args[:unsubscribe_instructions] body << @template_args[:unsubscribe_instructions]
end end
DiscoursePluginRegistry.apply_modifier(:message_builder_body, body, @opts) DiscoursePluginRegistry.apply_modifier(:message_builder_body, body, @opts, @to)
end end
def build_args def build_args