From 345ff4675ba79928a6de32399a577544607a12e7 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 14 Oct 2019 11:39:55 -0500 Subject: exclude suspended (sub)domains from peers list --- app/controllers/api/v1/instances/peers_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit