FEATURE: add trigger_with_pms option to topic tags changed automation trigger (#29122)

This commit is contained in:
Gabriel Grubba
2024-10-09 09:51:40 -03:00
committed by GitHub
parent 19fb8b8d57
commit 53f9c81790
4 changed files with 42 additions and 0 deletions

View File

@ -224,6 +224,10 @@ module DiscourseAutomation
DiscourseAutomation::Automation
.where(trigger: name, enabled: true)
.find_each do |automation|
if topic.private_message?
next if !automation.trigger_field("trigger_with_pms")["value"]
end
watching_categories = automation.trigger_field("watching_categories")
if watching_categories["value"]
next if !watching_categories["value"].include?(topic.category_id)

View File

@ -3,6 +3,7 @@
DiscourseAutomation::Triggerable.add(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED) do
field :watching_categories, component: :categories
field :watching_tags, component: :tags
field :trigger_with_pms, component: :boolean
placeholder :topic_url
placeholder :topic_title