about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-01-03 20:17:13 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-01-03 20:17:13 +0000
commitfc884d015a1a2d6c31976af3d63039390fa15939 (patch)
tree0cb950fd716f3f2cb9f13348cf42fb6e4bc8b909 /app/serializers
parent933840bebf4ce8f5282c88e8c3e8c1b3675fbf2d (diff)
parentd907d4352e9b6cb22bc1fabd42ca3fc60aef8a37 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/activitypub/follow_serializer.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/serializers/activitypub/follow_serializer.rb b/app/serializers/activitypub/follow_serializer.rb
index 86c9992fe..eecd64701 100644
--- a/app/serializers/activitypub/follow_serializer.rb
+++ b/app/serializers/activitypub/follow_serializer.rb
@@ -1,11 +1,12 @@
 # frozen_string_literal: true
 
 class ActivityPub::FollowSerializer < ActiveModel::Serializer
-  attributes :id, :type, :actor
+  attributes :type, :actor
+  attribute :id, if: :dereferencable?
   attribute :virtual_object, key: :object
 
   def id
-    [ActivityPub::TagManager.instance.uri_for(object.account), '#follows/', object.id].join
+    ActivityPub::TagManager.instance.uri_for(object)
   end
 
   def type
@@ -19,4 +20,8 @@ class ActivityPub::FollowSerializer < ActiveModel::Serializer
   def virtual_object
     ActivityPub::TagManager.instance.uri_for(object.target_account)
   end
+
+  def dereferencable?
+    object.respond_to?(:object_type)
+  end
 end