2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 23:54:20 +08:00
discourse/app/serializers/search_post_serializer.rb
Natalie Tay 5bcf21d094
FIX: Respect show_original for search results (#36042)
Blurbs do not respect the "show original" toggle unlike posts, make it
so.
2025-11-17 12:06:08 +08:00

37 lines
722 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, scope:)
end
def include_blurb?
options[:result].present?
end
def include_cooked?
false
end
def include_ignored?
false
end
end