mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 00:05:39 +08:00
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)
25 lines
540 B
Ruby
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
|