about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib')
-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