Skip to content

Commit

Permalink
Change priority of delete activity forwards for replies and reblogs (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 8f2ecd8 commit 638ef90
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/lib/activitypub/activity/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def forward_for_reblogs
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|
ActivityPub::LowPriorityDeliveryWorker.push_bulk(inboxes) do |inbox_url|
[payload, rebloggers_ids.first, inbox_url]
end
end
Expand All @@ -61,7 +61,12 @@ def reply_to_local?

def forward_for_reply
return unless @json['signature'].present? && reply_to_local?
ActivityPub::RawDistributionWorker.perform_async(Oj.dump(@json), replied_to_status.account_id, [@account.preferred_inbox_url])

inboxes = replied_to_status.account.followers.inboxes - [@account.preferred_inbox_url]

ActivityPub::LowPriorityDeliveryWorker.push_bulk(inboxes) do |inbox_url|
[payload, replied_to_status.account_id, inbox_url]
end
end

def delete_now!
Expand Down

0 comments on commit 638ef90

Please sign in to comment.