mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 05:44:35 +08:00
d777844ed6
In a category's settings, the Tags tab has two new fields to specify the number of tags that must be added to a topic from a tag group. When creating a new topic, an error will be shown to the user if the requirement isn't met.
36 lines
676 B
Ruby
36 lines
676 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SiteCategorySerializer < BasicCategorySerializer
|
|
|
|
attributes :allowed_tags,
|
|
:allowed_tag_groups,
|
|
:allow_global_tags,
|
|
:min_tags_from_required_group,
|
|
:required_tag_group_name
|
|
|
|
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 required_tag_group_name
|
|
object.required_tag_group&.name
|
|
end
|
|
|
|
end
|