2014-09-02 05:15:08 -04:00
|
|
|
class GroupedSearchResultSerializer < ApplicationSerializer
|
|
|
|
has_many :posts, serializer: SearchPostSerializer
|
2017-02-13 10:10:28 -05:00
|
|
|
has_many :users, serializer: SearchResultUserSerializer
|
2014-09-02 05:15:08 -04:00
|
|
|
has_many :categories, serializer: BasicCategorySerializer
|
2017-08-25 11:52:18 -04:00
|
|
|
has_many :tags, serializer: TagSerializer
|
2017-11-10 15:38:54 -05:00
|
|
|
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id, :more_full_page_results, :can_create_topic
|
2017-07-17 11:57:13 -04:00
|
|
|
|
|
|
|
def search_log_id
|
|
|
|
object.search_log_id
|
|
|
|
end
|
|
|
|
|
2017-07-17 15:42:32 -04:00
|
|
|
def include_search_log_id?
|
|
|
|
search_log_id.present?
|
|
|
|
end
|
|
|
|
|
2017-08-25 11:52:18 -04:00
|
|
|
def include_tags?
|
|
|
|
SiteSetting.tagging_enabled
|
|
|
|
end
|
|
|
|
|
2017-11-10 15:38:54 -05:00
|
|
|
def can_create_topic
|
|
|
|
scope.can_create?(Topic)
|
|
|
|
end
|
|
|
|
|
2014-09-02 05:15:08 -04:00
|
|
|
end
|