FEATURE: Added trigger for topic tags changed (#28176)

* FEATURE: Added trigger for topic tags changed

* DEV: register new file in plugin.rb

* DEV: update to use already existing `:topic_tags_changed` event

* DEV: Add tests to topic_tags_changed trigger

remove `watching_user` field

* DEV: add more tests to topic_tags_changed_spec.rb

* DEV: update tests and implementation for topic tags changed automation trigger

* DEV: update checking for tags changed automation

* DEV: Update argument application for `handle_topic_tags_changed`
This commit is contained in:
Gabriel Grubba
2024-08-02 09:58:51 -03:00
committed by GitHub
parent 7977ae61f7
commit ec46487870
7 changed files with 193 additions and 0 deletions

View File

@ -72,6 +72,7 @@ after_initialize do
lib/discourse_automation/triggers/recurring
lib/discourse_automation/triggers/stalled_topic
lib/discourse_automation/triggers/stalled_wiki
lib/discourse_automation/triggers/topic_tags_changed
lib/discourse_automation/triggers/topic
lib/discourse_automation/triggers/user_added_to_group
lib/discourse_automation/triggers/user_badge_granted
@ -181,6 +182,14 @@ after_initialize do
DiscourseAutomation::EventHandlers.handle_pm_created(topic) if topic.private_message?
end
on(:topic_tags_changed) do |topic, tags|
DiscourseAutomation::EventHandlers.handle_topic_tags_changed(
topic,
tags[:old_tag_names],
tags[:new_tag_names],
)
end
on(:post_created) do |post|
DiscourseAutomation::EventHandlers.handle_post_created_edited(post, :create)
end