FEATURE: Add 'New users only' option to user_updated trigger (#26648)

This commit adds a new option to the `user_updated` trigger of the automation plugin to only trigger an automation for new users that join after the automation is enabled.

Internal topic: t/125829/9.
This commit is contained in:
Osama Sayegh
2024-04-16 21:13:11 +03:00
committed by GitHub
parent 57d29b6f3b
commit 4733369f71
7 changed files with 190 additions and 2 deletions

View File

@ -208,6 +208,9 @@ after_initialize do
register_topic_custom_field_type(DiscourseAutomation::AUTO_RESPONDER_TRIGGERED_IDS, [:integer])
on(:user_updated) { |user| DiscourseAutomation::EventHandlers.handle_user_updated(user) }
on(:user_created) do |user|
DiscourseAutomation::EventHandlers.handle_user_updated(user, new_user: true)
end
register_user_custom_field_type(DiscourseAutomation::CUSTOM_FIELD, [:integer])
register_post_custom_field_type(DiscourseAutomation::CUSTOM_FIELD, [:integer])