|
|
@ -1,12 +1,15 @@
|
|
|
|
# frozen_string_literal: true
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
|
|
class ActivityPub::NoteSerializer < ActiveModel::Serializer
|
|
|
|
class ActivityPub::NoteSerializer < ActiveModel::Serializer
|
|
|
|
attributes :id, :type, :summary, :content,
|
|
|
|
attributes :id, :type, :summary,
|
|
|
|
:in_reply_to, :published, :url,
|
|
|
|
:in_reply_to, :published, :url,
|
|
|
|
:attributed_to, :to, :cc, :sensitive,
|
|
|
|
:attributed_to, :to, :cc, :sensitive,
|
|
|
|
:atom_uri, :in_reply_to_atom_uri,
|
|
|
|
:atom_uri, :in_reply_to_atom_uri,
|
|
|
|
:conversation
|
|
|
|
:conversation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attribute :content, unless: :language?
|
|
|
|
|
|
|
|
attribute :content_map, if: :language?
|
|
|
|
|
|
|
|
|
|
|
|
has_many :media_attachments, key: :attachment
|
|
|
|
has_many :media_attachments, key: :attachment
|
|
|
|
has_many :virtual_tags, key: :tag
|
|
|
|
has_many :virtual_tags, key: :tag
|
|
|
|
|
|
|
|
|
|
|
@ -26,6 +29,14 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
|
|
|
|
Formatter.instance.format(object)
|
|
|
|
Formatter.instance.format(object)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def content_map
|
|
|
|
|
|
|
|
{ object.language => Formatter.instance.format(object) }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def language?
|
|
|
|
|
|
|
|
object.language.present?
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def in_reply_to
|
|
|
|
def in_reply_to
|
|
|
|
return unless object.reply? && !object.thread.nil?
|
|
|
|
return unless object.reply? && !object.thread.nil?
|
|
|
|
|
|
|
|
|
|
|
|