about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-23 09:38:27 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:20 -0500
commit5622de4a785e6b7c9a4946af3efaf8b4c2bc5755 (patch)
treeb9378500aa449af54ac09c44b2aba8f6ee2a184b /app/serializers
parent5de7e2d667fa55f353a8b3d988cd047c118a4250 (diff)
[Feature] Support Misskey-compatible boosts with attached content notes
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/activitypub/note_serializer.rb16
1 files changed, 15 insertions, 1 deletions
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