FEATURE: limits post created edited trigger to a group (#31523)

This commit allows admins to limit the post created/edited trigger
execution to a specific post user group.

It's for example useful if you want to auto tag all the topics created
by member of a specific group.
This commit is contained in:
Joffrey JAFFEUX
2025-02-26 10:52:40 +01:00
committed by GitHub
parent fbe5a9c710
commit 699541af75
4 changed files with 40 additions and 4 deletions

View File

@ -65,6 +65,9 @@ module DiscourseAutomation
next if ignore_group_members && post.user.in_any_groups?(restricted_group_ids)
end
user_group = automation.trigger_field("restricted_user_group")["value"]
next if user_group && !post.user.in_any_groups?([user_group])
ignore_automated = automation.trigger_field("ignore_automated")
next if ignore_automated["value"] && post.incoming_email&.is_auto_generated?

View File

@ -15,6 +15,7 @@ DiscourseAutomation::Triggerable.add(DiscourseAutomation::Triggers::POST_CREATED
field :restricted_category, component: :category
field :restricted_tags, component: :tags
field :restricted_groups, component: :groups
field :restricted_user_group, component: :group
field :ignore_automated, component: :boolean
field :ignore_group_members, component: :boolean
field :valid_trust_levels, component: :"trust-levels"