From 0c003e51189f5d9f79d7f164a4d55ad7f7d2cb0e Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Fri, 21 Feb 2020 23:17:02 -0600 Subject: make peers api take graylist mode into consideration --- app/controllers/api/v1/instances/peers_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app') 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! -- cgit