mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-09 11:48:47 +00:00
27 lines
527 B
Ruby
27 lines
527 B
Ruby
|
# 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
|