diff options
-rw-r--r-- | app/lib/activitypub/adapter.rb | 4 | ||||
-rw-r--r-- | app/serializers/activitypub/actor_serializer.rb | 8 | ||||
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 8 | ||||
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 6 |
5 files changed, 26 insertions, 6 deletions
diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb index ec352f367..b10c588a2 100644 --- a/app/lib/activitypub/adapter.rb +++ b/app/lib/activitypub/adapter.rb @@ -24,6 +24,10 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base 'Big' => 'https://tails.monsterpit.net/#', 'tailsNeverFail' => 'Big:tailsNeverFail', }, + trans: { + 'mp' => 'https://monsterpit.net/#', + 'trans' => 'mp:trans', + }, adult_content: { 'mp' => 'https://monsterpit.net/ns#', 'adultContent' => 'mp:adultContent' diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 7ea28afd5..7297d7c42 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -7,14 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer context_extensions :manually_approves_followers, :featured, :also_known_as, :moved_to, :property_value, :hashtag, :emoji, - :adult_content, :gently, :kobold, :froze, :big + :adult_content, :gently, :kobold, :froze, :big, :trans attributes :id, :type, :following, :followers, :inbox, :outbox, :featured, :preferred_username, :name, :summary, :url, :manually_approves_followers, :gently, :kobold, :adult_content, - :froze, :tails_never_fail + :froze, :tails_never_fail, :trans has_one :public_key, serializer: ActivityPub::PublicKeySerializer @@ -41,6 +41,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer delegate :moved?, to: :object + def trans + 'rights' + end + def id account_url(object) end diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 4b3612d52..bc9fcacf4 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -3,13 +3,13 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer context_extensions :conversation, :sensitive, :big, :hashtag, :emoji, :focal_point, :blurhash, - :reject_replies + :reject_replies, :trans attributes :id, :type, :summary, :in_reply_to, :published, :updated, :url, :attributed_to, :to, :cc, :sensitive, :conversation, :source, :tails_never_fail, - :reject_replies + :reject_replies, :trans attribute :content attribute :content_map, if: :language? @@ -25,6 +25,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer attribute :end_time, if: :poll_and_expires? attribute :closed, if: :poll_and_expired? + def trans + 'rights' + end + def id raise Mastodon::NotPermittedError, 'Local-only statuses should not be serialized' if object.local_only? ActivityPub::TagManager.instance.uri_for(object) diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 3e826aaf3..54308af1b 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -7,7 +7,7 @@ class REST::AccountSerializer < ActiveModel::Serializer :updated_at, :note, :url, :avatar, :avatar_static, :header, :header_static, :followers_count, :following_count, :statuses_count, :replies, :adult_content, :gently, :kobold, :role, :froze, :identity, - :limited, :signature + :limited, :signature, :trans has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested? has_many :emojis, serializer: REST::CustomEmojiSerializer @@ -22,6 +22,10 @@ class REST::AccountSerializer < ActiveModel::Serializer has_many :fields + def trans + 'rights' + end + def id object.id.to_s end diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 8b0bce61e..cb584e1d6 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -6,7 +6,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attributes :id, :created_at, :updated_at, :in_reply_to_id, :in_reply_to_account_id, :sensitive, :spoiler_text, :visibility, :language, :uri, :url, :replies_count, :reblogs_count, - :favourites_count, :network, :curated, :reject_replies + :favourites_count, :network, :curated, :reject_replies, :trans attribute :favourited, if: :current_user? attribute :reblogged, if: :current_user? @@ -33,6 +33,10 @@ class REST::StatusSerializer < ActiveModel::Serializer has_one :preview_card, key: :card, serializer: REST::PreviewCardSerializer has_one :preloadable_poll, key: :poll, serializer: REST::PollSerializer + def trans + 'rights' + end + def id object.id.to_s end |