You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
851 B
42 lines
851 B
# 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
|
|
end
|
|
|
|
private
|
|
|
|
def filtered_instances
|
|
InstanceFilter.new(filter_params).results
|
|
end
|
|
|
|
def paginated_instances
|
|
filtered_instances.page(params[:page])
|
|
end
|
|
|
|
helper_method :paginated_instances
|
|
|
|
def ordered_instances
|
|
paginated_instances.map { |account| Instance.new(account) }
|
|
end
|
|
|
|
def subscribeable_accounts
|
|
Account.with_followers.remote.where(domain: params[:by_domain])
|
|
end
|
|
|
|
def filter_params
|
|
params.permit(
|
|
:domain_name
|
|
)
|
|
end
|
|
end
|
|
end
|