about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-09-19 16:56:21 -0500
committerFire Demon <firedemon@creature.cafe>2020-09-19 17:41:24 -0500
commitf190e3c8c4840e6f92b90d913096e80eafc893eb (patch)
tree2ec9486918dd3db72f39b2d1cfb56244aeba5e4f /app
parent172cdaa3282e2e144722a866fdfdb74b9baf7e59 (diff)
[Federation] Add support for distributing ActivityPub events to all unsuspended inboxes
Diffstat (limited to 'app')
-rw-r--r--app/workers/activitypub/distribution_worker.rb5
-rw-r--r--app/workers/activitypub/raw_distribution_worker.rb5
-rw-r--r--app/workers/activitypub/reply_distribution_worker.rb5
-rw-r--r--app/workers/activitypub/update_distribution_worker.rb2
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