From 5622de4a785e6b7c9a4946af3efaf8b4c2bc5755 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sun, 23 Aug 2020 09:38:27 -0500 Subject: [Feature] Support Misskey-compatible boosts with attached content notes --- app/serializers/activitypub/note_serializer.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'app/serializers/activitypub/note_serializer.rb') diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index acadce1b2..1ab2ed35a 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -3,7 +3,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :direct_message - context_extensions :edited, :server_metadata, :root + context_extensions :edited, :server_metadata, :root, :reblog attributes :id, :type, :summary, :in_reply_to, :published, :url, @@ -13,6 +13,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer attributes :updated, :root attribute :title, key: :name, if: :title_present? + attribute :reblog, if: :reblog_present? + attribute :renote, key: '_misskey_quote', if: :reblog_present? attribute :content attribute :content_map, if: :language? @@ -208,6 +210,18 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer Mastodon::Version.server_metadata_json end + def reblog + ActivityPub::TagManager.instance.uri_for(object.reblog) + end + + def renote + ActivityPub::TagManager.instance.uri_for(object.reblog) + end + + def reblog_present? + object.reblog_of_id.present? + end + class MediaAttachmentSerializer < ActivityPub::Serializer context_extensions :blurhash, :focal_point -- cgit