Skip to content

Commit

Permalink
Have Follow activities bypass availability (mastodon#27586)
Browse files Browse the repository at this point in the history
Co-authored-by: Claire <[email protected]>
  • Loading branch information
ShadowJonathan and ClearlyClaire authored Oct 27, 2023
1 parent 93e4cdc commit 1cc5129
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/follow_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def request_follow!
if @target_account.local?
LocalNotificationWorker.perform_async(@target_account.id, follow_request.id, follow_request.class.name, 'follow_request')
elsif @target_account.activitypub?
ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), @source_account.id, @target_account.inbox_url)
ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), @source_account.id, @target_account.inbox_url, { 'bypass_availability' => true })
end

follow_request
Expand Down
5 changes: 3 additions & 2 deletions app/workers/activitypub/delivery_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ class ActivityPub::DeliveryWorker
HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze

def perform(json, source_account_id, inbox_url, options = {})
return unless DeliveryFailureTracker.available?(inbox_url)

@options = options.with_indifferent_access

return unless @options[:bypass_availability] || DeliveryFailureTracker.available?(inbox_url)

@json = json
@source_account = Account.find(source_account_id)
@inbox_url = inbox_url
Expand Down

0 comments on commit 1cc5129

Please sign in to comment.