Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add modifiers to message_builder so plugins can customize subject/body/html #26867

Merged
merged 3 commits into from May 13, 2024

Conversation

marstall
Copy link
Contributor

@marstall marstall commented May 3, 2024

(also add notification_type to email_opts so plugins can access it)

Copy link
Contributor

@megothss megothss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add a few specs to ensure the modifiers are working as expected.

Also I think you forgot to run stree. 😄

@@ -126,6 +126,7 @@ def subject
else
subject = @opts[:subject]
end
subject = DiscoursePluginRegistry.apply_modifier(:user_notification_subject, subject,@opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message builder is also used for other e-mails type, not only notifications.

The modifiers name should be more generic, something like message_builder_subject for example.

@@ -164,6 +165,7 @@ def html_part
html_body: html_override.html_safe,
},
)
html = DiscoursePluginRegistry.apply_modifier(:user_notification_html_part, html,@opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like above, maybe message_builder_html_part?

@@ -184,6 +186,7 @@ def body
body << "\n"
body << @template_args[:unsubscribe_instructions]
end
body = DiscoursePluginRegistry.apply_modifier(:user_notification_body, body,@opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like above, maybe message_builder_body?

@marstall marstall requested a review from megothss May 13, 2024 10:18
@marstall marstall merged commit 6df2f94 into main May 13, 2024
16 checks passed
@marstall marstall deleted the agc-notification-email-customizations branch May 13, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants