about summary refs log tree commit diff
path: root/app/lib/activitypub/activity
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-08-26 18:52:53 +0200
committerGitHub <noreply@github.com>2017-08-26 18:52:53 +0200
commit0397c58b61d8a364ff488fc5631bfc751903c242 (patch)
tree89c98b42dac413fba86c5202d6e5844cc99942b4 /app/lib/activitypub/activity
parent884b085f534b02c664bcddd3a2fefcad6d4e5cc4 (diff)
Forward ActivityPub deletes to followers of rebloggers (#4706)
Diffstat (limited to 'app/lib/activitypub/activity')
-rw-r--r--app/lib/activitypub/activity/delete.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/delete.rb b/app/lib/activitypub/activity/delete.rb
index a1598dfd3..e7eb53a02 100644
--- a/app/lib/activitypub/activity/delete.rb
+++ b/app/lib/activitypub/activity/delete.rb
@@ -8,7 +8,24 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
     if status.nil?
       delete_later!(object_uri)
     else
-      RemoveStatusService.new.call(status)
+      forward_for_reblogs(status)
+      delete_now!(status)
     end
   end
+
+  private
+
+  def forward_for_reblogs(status)
+    ActivityPub::RawDistributionWorker.push_bulk(status.reblogs.includes(:account).references(:account).merge(Account.local).pluck(:account_id)) do |account|
+      [payload, account.id]
+    end
+  end
+
+  def delete_now!(status)
+    RemoveStatusService.new.call(status)
+  end
+
+  def payload
+    @payload ||= Oj.dump(@json)
+  end
 end