about summary refs log tree commit diff
path: root/app/serializers/activitypub
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-10-08 14:41:59 +0200
committerGitHub <noreply@github.com>2017-10-08 14:41:59 +0200
commit6e4046fc3f3973ba0b6994930a8b58726e507003 (patch)
tree0fa3e69bd1ae61b18ccd9bc6a0d76e4cbf0c3b3d /app/serializers/activitypub
parentf0c939c431fc7b738208cfd2bc1ea914c8b03769 (diff)
Fix #5178 - Use object URI only in Announce, instead of embedding (#5266)
Diffstat (limited to 'app/serializers/activitypub')
-rw-r--r--app/serializers/activitypub/activity_serializer.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb
index b252e008b..df399211c 100644
--- a/app/serializers/activitypub/activity_serializer.rb
+++ b/app/serializers/activitypub/activity_serializer.rb
@@ -3,10 +3,11 @@
 class ActivityPub::ActivitySerializer < ActiveModel::Serializer
   attributes :id, :type, :actor, :published, :to, :cc
 
-  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer
+  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :announce?
+  attribute :proper_uri, key: :object, if: :announce?
 
   def id
-    [ActivityPub::TagManager.instance.activity_uri_for(object)].join
+    ActivityPub::TagManager.instance.activity_uri_for(object)
   end
 
   def type
@@ -29,6 +30,10 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
     ActivityPub::TagManager.instance.cc(object)
   end
 
+  def proper_uri
+    ActivityPub::TagManager.instance.uri_for(object.proper)
+  end
+
   def announce?
     object.reblog?
   end