# frozen_string_literal: true
module Admin
class InstancesController < BaseController
def index
@instances = ordered_instances
end
def resubscribe
params.require(:by_domain)
Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
redirect_to admin_instances_path
private
def filtered_instances
InstanceFilter.new(filter_params).results
def paginated_instances
filtered_instances.page(params[:page])
helper_method :paginated_instances
def ordered_instances
paginated_instances.map { |account| Instance.new(account) }
def subscribeable_accounts
Account.with_followers.remote.where(domain: params[:by_domain])
def filter_params
params.permit(
:domain_name
)