about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/api/v1/instances/peers_controller.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/api/v1/instances/peers_controller.rb b/app/controllers/api/v1/instances/peers_controller.rb
index 3a4c11783..884e15bb1 100644
--- a/app/controllers/api/v1/instances/peers_controller.rb
+++ b/app/controllers/api/v1/instances/peers_controller.rb
@@ -16,8 +16,13 @@ class Api::V1::Instances::PeersController < Api::BaseController
   private
 
   def actively_federated_domains
-    blocks = DomainBlock.suspend
-    Account.remote.where(suspended_at: nil).domains.reject { |domain| blocks.where('domain LIKE ?', "%.#{domain}").exists? }
+    scope = if Settings.auto_reject_unknown
+              Account.remote.where(suspended_at: nil, known: true)
+            else
+              Account.remote.where(suspended_at: nil)
+            end
+
+    scope.select(:domain).distinct(:domain).reorder(:domain).pluck(:domain)
   end
 
   def require_enabled_api!