discourse-ai/app/serializers/ai_sentiment_post_serializer.rb

27 lines
527 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class AiSentimentPostSerializer < ApplicationSerializer
attributes :post_id,
:topic_id,
:topic_title,
:post_number,
:username,
:name,
:avatar_template,
:excerpt,
:sentiment,
:truncated
def avatar_template
User.avatar_template(object.username, object.uploaded_avatar_id)
end
def excerpt
Post.excerpt(object.post_cooked)
end
def truncated
true
end
end