mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 14:49:07 +08:00
68c74e9b93
Previously we only supported a single 'required tag group' for a category. This commit allows admins to specify multiple required tag groups, each with their own minimum tag count. A new category_required_tag_groups database table replaces the existing columns on the categories table. Data is automatically migrated.
36 lines
711 B
Ruby
36 lines
711 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SiteCategorySerializer < BasicCategorySerializer
|
|
|
|
attributes :allowed_tags,
|
|
:allowed_tag_groups,
|
|
:allow_global_tags,
|
|
:read_only_banner
|
|
|
|
has_many :category_required_tag_groups, key: :required_tag_groups, embed: :objects
|
|
|
|
def include_allowed_tags?
|
|
SiteSetting.tagging_enabled
|
|
end
|
|
|
|
def allowed_tags
|
|
object.tags.pluck(:name)
|
|
end
|
|
|
|
def include_allowed_tag_groups?
|
|
SiteSetting.tagging_enabled
|
|
end
|
|
|
|
def allowed_tag_groups
|
|
object.tag_groups.pluck(:name)
|
|
end
|
|
|
|
def include_allow_global_tags?
|
|
SiteSetting.tagging_enabled
|
|
end
|
|
|
|
def include_required_tag_groups?
|
|
SiteSetting.tagging_enabled
|
|
end
|
|
end
|