discourse/plugins/discourse-post-voting/app/serializers/reviewable_post_voting_comment_serializer.rb
Jarek Radosz 5265fe7129
FEATURE: Restore the crawler view for post-voting comments (#39636)
Removed in 2022 because of perf considerations.

This restores it and updates the implementation and styling. The perf
should not be an issue anymore:

1. it's now rendered only in the crawler view (and not for regular
logged-in users or anons)
2. it previously used Rails' partial rendering which re-read file on
each request. `register_html_builder` is more efficient (and this
particular block skips rendering completely when not applicable)
2026-04-29 16:55:17 +02:00

25 lines
540 B
Ruby

# frozen_string_literal: true
require_dependency "reviewable_serializer"
class ReviewablePostVotingCommentSerializer < ReviewableSerializer
target_attributes :cooked, :raw, :comment_cooked, :post_id
payload_attributes :comment_cooked, :transcript_topic_id, :cooked, :raw, :created_by
attributes :target_id, :comment_cooked
def created_from_flag?
true
end
def target_id
object.target&.id
end
def comment_cooked
object.payload&.dig("comment_cooked")
end
def include_target_created_at?
true
end
end