0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-05-19 23:40:07 +02:00
discourse-custom-wizard/lib/custom_wizard/extensions/discourse_tagging.rb
2022-03-12 14:00:07 +01:00

19 Zeilen
501 B
Ruby

# frozen_string_literal: true
require 'request_store'
module CustomWizardDiscourseTagging
def filter_allowed_tags(guardian, opts = {})
if tag_groups = ::RequestStore.store[:tag_groups]
tag_group_array = tag_groups.split(",")
filtered_tags = TagGroup.includes(:tags).where(name: tag_group_array).map do |tag_group|
tag_group.tags.pluck(:name)
end.flatten
opts[:only_tag_names] ||= []
opts[:only_tag_names].push(*filtered_tags)
end
super
end
end