2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-09 13:41:25 -04:00
|
|
|
class SearchPostSerializer < BasicPostSerializer
|
2017-05-30 20:53:12 -04:00
|
|
|
has_one :topic, serializer: SearchTopicListItemSerializer
|
2014-09-02 05:15:08 -04:00
|
|
|
|
2020-08-07 00:43:09 -04:00
|
|
|
attributes :like_count, :blurb, :post_number, :topic_title_headline
|
|
|
|
|
|
|
|
def include_topic_title_headline?
|
2023-04-03 14:02:42 -04:00
|
|
|
if options[:result]
|
|
|
|
options[:result].use_pg_headlines_for_excerpt
|
|
|
|
elsif SiteSetting.use_pg_headlines_for_excerpt
|
2020-08-07 00:43:09 -04:00
|
|
|
object.topic_title_headline.present?
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def topic_title_headline
|
|
|
|
object.topic_title_headline
|
|
|
|
end
|
2015-09-18 03:16:10 -04:00
|
|
|
|
2014-09-02 05:15:08 -04:00
|
|
|
def blurb
|
|
|
|
options[:result].blurb(object)
|
|
|
|
end
|
2019-03-20 02:38:14 -04:00
|
|
|
|
2021-06-15 01:32:41 -04:00
|
|
|
def include_blurb?
|
|
|
|
options[:result].present?
|
|
|
|
end
|
|
|
|
|
2019-03-20 02:38:14 -04:00
|
|
|
def include_cooked?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_ignored?
|
|
|
|
false
|
|
|
|
end
|
2014-09-02 05:15:08 -04:00
|
|
|
end
|