discourse/app/serializers/grouped_search_result_serializer.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

28 lines
719 B
Ruby

# frozen_string_literal: true
class GroupedSearchResultSerializer < ApplicationSerializer
has_many :posts, serializer: SearchPostSerializer
has_many :users, serializer: SearchResultUserSerializer
has_many :categories, serializer: BasicCategorySerializer
has_many :tags, serializer: TagSerializer
has_many :groups, serializer: BasicGroupSerializer
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id, :more_full_page_results, :can_create_topic
def search_log_id
object.search_log_id
end
def include_search_log_id?
search_log_id.present?
end
def include_tags?
SiteSetting.tagging_enabled
end
def can_create_topic
scope.can_create?(Topic)
end
end