mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 16:29:25 +08:00
2cb9e85d14
* FEATURE: add category banner for why a user cannot post Adds a category banner for why a user is unable to post in a category. Also adds an extra alert for the user when a user is unable to create a topic in a category and they still try and click on the disabled-looking new topic button.
37 lines
708 B
Ruby
37 lines
708 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,
|
|
:read_only_banner
|
|
|
|
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
|