diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-02-21 23:17:02 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-21 23:17:02 -0600 |
commit | 0c003e51189f5d9f79d7f164a4d55ad7f7d2cb0e (patch) | |
tree | c0b7d878d72c78193bc6742f1c42925326f02bb4 /app | |
parent | 1efc03527b7593690b8b5690a70f947aacced5d7 (diff) |
make peers api take graylist mode into consideration
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/v1/instances/peers_controller.rb | 9 |
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! |