2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 17:15:08 +08:00
|
|
|
class GroupedSearchResultSerializer < ApplicationSerializer
|
|
|
|
has_many :posts, serializer: SearchPostSerializer
|
2017-02-13 23:10:28 +08:00
|
|
|
has_many :users, serializer: SearchResultUserSerializer
|
2014-09-02 17:15:08 +08:00
|
|
|
has_many :categories, serializer: BasicCategorySerializer
|
2017-08-25 23:52:18 +08:00
|
|
|
has_many :tags, serializer: TagSerializer
|
2019-03-04 17:30:09 +08:00
|
|
|
has_many :groups, serializer: BasicGroupSerializer
|
2019-07-02 09:21:52 +08:00
|
|
|
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id, :more_full_page_results, :can_create_topic, :error
|
2017-07-17 23:57:13 +08:00
|
|
|
|
|
|
|
def search_log_id
|
|
|
|
object.search_log_id
|
|
|
|
end
|
|
|
|
|
2017-07-18 03:42:32 +08:00
|
|
|
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
|
|
|
|
|
2017-11-11 04:38:54 +08:00
|
|
|
def can_create_topic
|
|
|
|
scope.can_create?(Topic)
|
|
|
|
end
|
|
|
|
|
2014-09-02 17:15:08 +08:00
|
|
|
end
|