diff options
4 files changed, 11 insertions, 6 deletions
diff --git a/app/workers/activitypub/distribution_worker.rb b/app/workers/activitypub/distribution_worker.rb index 716d751c4..ff4bac018 100644 --- a/app/workers/activitypub/distribution_worker.rb +++ b/app/workers/activitypub/distribution_worker.rb @@ -6,7 +6,8 @@ class ActivityPub::DistributionWorker sidekiq_options queue: 'push' - def perform(status_id) + def perform(status_id, options = {}) + @options = options.with_indifferent_access @status = Status.find(status_id) @account = @status.account @payload = {} @@ -33,6 +34,8 @@ class ActivityPub::DistributionWorker end def inboxes + return Account.remote.without_suspended.inboxes if @options[:all_servers] || @account.id == -99 + # Deliver the status to all followers. # If the status is a reply to another local status, also forward it to that # status' authors' followers. diff --git a/app/workers/activitypub/raw_distribution_worker.rb b/app/workers/activitypub/raw_distribution_worker.rb index 41e61132f..3c65e4cd0 100644 --- a/app/workers/activitypub/raw_distribution_worker.rb +++ b/app/workers/activitypub/raw_distribution_worker.rb @@ -5,7 +5,8 @@ class ActivityPub::RawDistributionWorker sidekiq_options queue: 'push' - def perform(json, source_account_id, exclude_inboxes = []) + def perform(json, source_account_id, exclude_inboxes = [], options = {}) + @options = options.with_indifferent_access @account = Account.find(source_account_id) ActivityPub::DeliveryWorker.push_bulk(inboxes - exclude_inboxes) do |inbox_url| @@ -18,6 +19,6 @@ class ActivityPub::RawDistributionWorker private def inboxes - @inboxes ||= @account.followers.inboxes + @inboxes ||= (@options[:all_servers] || @account.id == -99 ? Account.remote.without_suspended.inboxes : @account.followers.inboxes) end end diff --git a/app/workers/activitypub/reply_distribution_worker.rb b/app/workers/activitypub/reply_distribution_worker.rb index e8648ffcd..f9044cbf3 100644 --- a/app/workers/activitypub/reply_distribution_worker.rb +++ b/app/workers/activitypub/reply_distribution_worker.rb @@ -9,7 +9,8 @@ class ActivityPub::ReplyDistributionWorker sidekiq_options queue: 'push' - def perform(status_id) + def perform(status_id, options = {}) + @options = options.with_indifferent_access @status = Status.find(status_id) @account = @status.thread&.account @payload = {} @@ -26,7 +27,7 @@ class ActivityPub::ReplyDistributionWorker private def inboxes - @inboxes ||= @account.followers.inboxes + @inboxes ||= (@options[:all_servers] || @account.id == -99 ? Account.remote.without_suspended.inboxes : @account.followers.inboxes) end def payload(domain) diff --git a/app/workers/activitypub/update_distribution_worker.rb b/app/workers/activitypub/update_distribution_worker.rb index 3a207f071..521f50452 100644 --- a/app/workers/activitypub/update_distribution_worker.rb +++ b/app/workers/activitypub/update_distribution_worker.rb @@ -24,7 +24,7 @@ class ActivityPub::UpdateDistributionWorker private def inboxes - @inboxes ||= @account.followers.inboxes + @inboxes ||= (@options[:all_servers] || @account.id == -99 ? Account.remote.without_suspended.inboxes : @account.followers.inboxes) end def signed_payload |