about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-02-15 18:02:45 +0100
committerThibaut Girka <thib@sitedethib.com>2019-02-15 18:02:45 +0100
commit06cc04fd239896d294210b8bbaadb7c611aaffe5 (patch)
tree1868711bbe9ee79b25ff10a585457cfa0f9ac121 /app/serializers
parent2769b5446681898e8332cb505f499dac2a6e5717 (diff)
parent8ef50706a11e115e8b4aa31b30de93738bc7e754 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/activitypub/activity_serializer.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb
index 50c4f6a04..b51e8c544 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: :announce?
-  attribute :proper_uri, key: :object, if: :announce?
+  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :owned_announce?
+  attribute :proper_uri, key: :object, if: :owned_announce?
   attribute :atom_uri, if: :announce?
 
   def id
@@ -42,4 +42,8 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
   def announce?
     object.reblog?
   end
+
+  def owned_announce?
+    announce? && object.account == object.proper.account && object.proper.private_visibility?
+  end
 end