Refactor StatusReachFinder to be used in more places

This commit is contained in:
Eugen Rochko 2021-09-25 00:17:36 +02:00
parent c99d28369a
commit ce463ccb50
13 changed files with 321 additions and 99 deletions

View file

@ -39,7 +39,7 @@ class ActivityPub::DeliveryWorker
Request.new(:post, @inbox_url, body: @json, http_client: http_client).tap do |request|
request.on_behalf_of(@source_account, :uri, sign_with: @options[:sign_with])
request.add_headers(HEADERS)
request.add_headers({ 'Collection-Synchronization' => synchronization_header }) if ENV['DISABLE_FOLLOWERS_SYNCHRONIZATION'] != 'true' && @options[:synchronize_followers]
request.add_headers({ 'Collection-Synchronization' => synchronization_header }) if synchronize_followers?
end
end
@ -47,6 +47,14 @@ class ActivityPub::DeliveryWorker
"collectionId=\"#{account_followers_url(@source_account)}\", digest=\"#{@source_account.remote_followers_hash(@inbox_url)}\", url=\"#{account_followers_synchronization_url(@source_account)}\""
end
def synchronize_followers?
followers_synchronization_enabled? && @options[:synchronize_followers]
end
def followers_synchronization_enabled?
ENV['DISABLE_FOLLOWERS_SYNCHRONIZATION'] != 'true'
end
def perform_request
light = Stoplight(@inbox_url) do
request_pool.with(@host) do |http_client|