discourse/app/serializers/grouped_search_result_serializer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
817 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class GroupedSearchResultSerializer < ApplicationSerializer
has_many :posts, serializer: SearchPostSerializer
has_many :users, serializer: SearchResultUserSerializer
has_many :categories, serializer: BasicCategorySerializer
2017-08-25 23:52:18 +08:00
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,
:error
def search_log_id
object.search_log_id
end
def include_search_log_id?
search_log_id.present?
end
2017-08-25 23:52:18 +08:00
def include_tags?
SiteSetting.tagging_enabled
end
def can_create_topic
scope.can_create?(Topic)
end
end