diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-10-14 11:39:55 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-10-14 11:39:55 -0500 |
commit | 345ff4675ba79928a6de32399a577544607a12e7 (patch) | |
tree | 032d105005ab15860b3b14e39980390e161489f8 | |
parent | e6c1f51b29b9d1b84b81660dacdb2ce8a2787ea0 (diff) |
exclude suspended (sub)domains from peers list
-rw-r--r-- | app/controllers/api/v1/instances/peers_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/api/v1/instances/peers_controller.rb b/app/controllers/api/v1/instances/peers_controller.rb index a8891d126..93c4c45af 100644 --- a/app/controllers/api/v1/instances/peers_controller.rb +++ b/app/controllers/api/v1/instances/peers_controller.rb @@ -7,11 +7,16 @@ class Api::V1::Instances::PeersController < Api::BaseController respond_to :json def index - render_cached_json('api:v1:instances:peers:index', expires_in: 1.day) { Account.remote.domains } + render_cached_json('api:v1:instances:peers:index', expires_in: 1.day) { actively_federated_domains } end private + def actively_federated_domains + blocks = DomainBlock.suspend + Account.remote.where(suspended_at: nil).domains.reject { |domain| blocks.where('domain LIKE ?', "%.#{domain}").exists? } + end + def require_enabled_api! head 404 unless Setting.peers_api_enabled end |