* Rename positive_reactions_count to public_reactions_count * Add positive reactions count back in so we can remove it * Use public_category method for reactions * Add positive_reactions_count in case any old caches rely on it * Add positive_rxn_count to account for API endpoints * Remove unused method * One more spot... * Add method back in because of caches * Update specs to match new functionality * Fix typo * Remove unused methods
29 lines
713 B
Ruby
29 lines
713 B
Ruby
module Search
|
|
class CommentSerializer
|
|
include FastJsonapi::ObjectSerializer
|
|
|
|
attribute :id, &:search_id
|
|
|
|
attributes :path, :public_reactions_count
|
|
|
|
attribute :body_text, &:body_markdown
|
|
attribute :class_name do |comment|
|
|
comment.class.name
|
|
end
|
|
attribute :hotness_score, &:score
|
|
attribute :published do |_comment|
|
|
true
|
|
end
|
|
attribute :published_at, &:created_at
|
|
attribute :readable_publish_date_string, &:readable_publish_date
|
|
attribute :title do |comment|
|
|
comment.commentable&.title
|
|
end
|
|
|
|
attribute :user do |comment|
|
|
NestedUserSerializer.new(comment.user).serializable_hash.dig(
|
|
:data, :attributes
|
|
)
|
|
end
|
|
end
|
|
end
|