about summary refs log tree commit diff
path: root/app/serializers/activitypub
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-02-28 21:35:16 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-02-28 21:35:16 +0100
commitee7d79c0ce411ff7754e3ac31dbf27cb9e298f73 (patch)
treeac832ac2b5df2ebaa56f6b5ad1cdd6e0f18fcaaa /app/serializers/activitypub
parentd8498b39838eb352a9b268e0f22b1b025320dc73 (diff)
Fix serialization of boosts (#10129)
The condition introduced by #9998 was wrong, serializing boosts
that weren't self-boosts, and not serializing self-boosts.
Diffstat (limited to 'app/serializers/activitypub')
-rw-r--r--app/serializers/activitypub/activity_serializer.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb
index b51e8c544..c001e28aa 100644
--- a/app/serializers/activitypub/activity_serializer.rb
+++ b/app/serializers/activitypub/activity_serializer.rb
@@ -3,8 +3,8 @@
 class ActivityPub::ActivitySerializer < ActiveModel::Serializer
   attributes :id, :type, :actor, :published, :to, :cc
 
-  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :owned_announce?
-  attribute :proper_uri, key: :object, if: :owned_announce?
+  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, if: :serialize_object?
+  attribute :proper_uri, key: :object, unless: :serialize_object?
   attribute :atom_uri, if: :announce?
 
   def id
@@ -43,7 +43,9 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
     object.reblog?
   end
 
-  def owned_announce?
-    announce? && object.account == object.proper.account && object.proper.private_visibility?
+  def serialize_object?
+    return true unless announce?
+    # Serialize private self-boosts of local toots
+    object.account == object.proper.account && object.proper.private_visibility? && object.local?
   end
 end