diff options
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 13 | ||||
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 2 | ||||
-rw-r--r-- | app/serializers/rest/credential_account_serializer.rb | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index ddafb540d..82b7ffe95 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -1,12 +1,15 @@ # frozen_string_literal: true class ActivityPub::NoteSerializer < ActiveModel::Serializer - attributes :id, :type, :summary, :content, + attributes :id, :type, :summary, :in_reply_to, :published, :url, :attributed_to, :to, :cc, :sensitive, :atom_uri, :in_reply_to_atom_uri, :conversation + attribute :content + attribute :content_map, if: :language? + has_many :media_attachments, key: :attachment has_many :virtual_tags, key: :tag @@ -26,6 +29,14 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer Formatter.instance.format(object) end + def content_map + { object.language => Formatter.instance.format(object) } + end + + def language? + object.language.present? + end + def in_reply_to return unless object.reply? && !object.thread.nil? diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 6adcd7039..3a724aa7c 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -25,7 +25,7 @@ class REST::AccountSerializer < ActiveModel::Serializer end def note - Formatter.instance.simplified_format(object, custom_emojify: true) + Formatter.instance.simplified_format(object) end def url diff --git a/app/serializers/rest/credential_account_serializer.rb b/app/serializers/rest/credential_account_serializer.rb index 56857cba8..fb195eb07 100644 --- a/app/serializers/rest/credential_account_serializer.rb +++ b/app/serializers/rest/credential_account_serializer.rb @@ -9,6 +9,7 @@ class REST::CredentialAccountSerializer < REST::AccountSerializer { privacy: user.setting_default_privacy, sensitive: user.setting_default_sensitive, + language: user.setting_default_language, note: object.note, fields: object.fields.map(&:to_h), } |