about summary refs log tree commit diff
path: root/app/presenters
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-16 15:07:20 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:41:03 -0500
commit78d33622a5b53a983e8d37777e8e56b9e3f3c29c (patch)
tree0e1b7f4f7fa521156ee5ea24bca79ccd5f6f7dca /app/presenters
parenta3a7c6e0ec6a80ea1989176f15224b1a27916338 (diff)
[Privacy] Federate references to objects than embedding them so that their permissions can be enforced on request
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/activitypub/activity_presenter.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/presenters/activitypub/activity_presenter.rb b/app/presenters/activitypub/activity_presenter.rb
index 41ce01474..471071efc 100644
--- a/app/presenters/activitypub/activity_presenter.rb
+++ b/app/presenters/activitypub/activity_presenter.rb
@@ -4,7 +4,7 @@ class ActivityPub::ActivityPresenter < ActiveModelSerializers::Model
   attributes :id, :type, :actor, :published, :to, :cc, :virtual_object
 
   class << self
-    def from_status(status, update: false)
+    def from_status(status, update: false, embed: true)
       new.tap do |presenter|
         default_activity    = update && status.edited.positive? ? 'Update' : 'Create'
         presenter.id        = ActivityPub::TagManager.instance.activity_uri_for(status)
@@ -14,6 +14,11 @@ class ActivityPub::ActivityPresenter < ActiveModelSerializers::Model
         presenter.to        = ActivityPub::TagManager.instance.to(status)
         presenter.cc        = ActivityPub::TagManager.instance.cc(status)
 
+        unless embed
+          presenter.virtual_object = ActivityPub::TagManager.instance.uri_for(status.proper)
+          next
+        end
+
         presenter.virtual_object = begin
           if status.reblog?
             if status.account == status.proper.account && status.proper.private_visibility? && status.local?