mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 17:55:14 +08:00
cbc5b2febc
Follow-up to #20939
38 lines
714 B
Ruby
38 lines
714 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SearchPostSerializer < BasicPostSerializer
|
|
has_one :topic, serializer: SearchTopicListItemSerializer
|
|
|
|
attributes :like_count, :blurb, :post_number, :topic_title_headline
|
|
|
|
def include_topic_title_headline?
|
|
if options[:result]
|
|
options[:result].use_pg_headlines_for_excerpt
|
|
elsif SiteSetting.use_pg_headlines_for_excerpt
|
|
object.topic_title_headline.present?
|
|
else
|
|
false
|
|
end
|
|
end
|
|
|
|
def topic_title_headline
|
|
object.topic_title_headline
|
|
end
|
|
|
|
def blurb
|
|
options[:result].blurb(object)
|
|
end
|
|
|
|
def include_blurb?
|
|
options[:result].present?
|
|
end
|
|
|
|
def include_cooked?
|
|
false
|
|
end
|
|
|
|
def include_ignored?
|
|
false
|
|
end
|
|
end
|