DiscourseEvent.on(:topic_created) do |topic|
guardian = Guardian.new(Discourse.system_user)
required_tag_names = [”sync1”, “sync2”, “sync3”, “sync4”]
DiscourseTagging.tag_topic_by_names(topic, guardian, ["apim"], append: true) if topic.tags.exists?(name: required_tag_names)
end
You need this
code.
Edit: You can also enforce it by adding a tag group and setting “apim” as the parent tag. In that case, users can choose “sync” tags only after selecting the parent tag “apim”.
I think it will be more useful if we allow users to select child tags first then we add the parent tag automatically
Most end users won’t know about the parent tag requirements.