about summary refs log tree commit diff
path: root/app/lib/activitypub/activity/delete.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-11-30 03:50:05 +0100
committerGitHub <noreply@github.com>2017-11-30 03:50:05 +0100
commit85e97ecab6db67faefb64557af9b2271d2b23735 (patch)
tree1cb8904147f87bcb567e77763e1c1541b1378d61 /app/lib/activitypub/activity/delete.rb
parentdc1ebd45a30d806fcef2dc33679457285ba430b4 (diff)
Fix too many forwards (#5854)
* Avoid sending explicit Undo->Announce when original deleted

* Do not forward a reply back to the server that sent it

* Deduplicate inboxes of rebloggers' followers for delete forwarding

* Adjust test

* Fix wrong class, bad SQL, wrong variable, outdated comment
Diffstat (limited to 'app/lib/activitypub/activity/delete.rb')
-rw-r--r--app/lib/activitypub/activity/delete.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/delete.rb b/app/lib/activitypub/activity/delete.rb
index 4c6afb090..d0fb49342 100644
--- a/app/lib/activitypub/activity/delete.rb
+++ b/app/lib/activitypub/activity/delete.rb
@@ -30,8 +30,11 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
   def forward_for_reblogs(status)
     return if @json['signature'].blank?
 
-    ActivityPub::RawDistributionWorker.push_bulk(status.reblogs.includes(:account).references(:account).merge(Account.local).pluck(:account_id)) do |account_id|
-      [payload, account_id]
+    rebloggers_ids = status.reblogs.includes(:account).references(:account).merge(Account.local).pluck(:account_id)
+    inboxes        = Account.where(id: ::Follow.where(target_account_id: rebloggers_ids).select(:account_id)).inboxes - [@account.preferred_inbox_url]
+
+    ActivityPub::DeliveryWorker.push_bulk(inboxes) do |inbox_url|
+      [payload, rebloggers_ids.first, inbox_url]
     end
   end