This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/app/controllers/admin/instances_controller.rb

44 lines
938 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Admin
class InstancesController < BaseController
def index
authorize :instance, :index?
@instances = ordered_instances
end
def resubscribe
authorize :instance, :resubscribe?
params.require(:by_domain)
Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
redirect_to admin_instances_path
end
private
2017-09-13 03:30:07 -07:00
def filtered_instances
InstanceFilter.new(filter_params).results
end
def paginated_instances
2017-09-13 03:30:07 -07:00
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.remote.where(protocol: :ostatus).where(domain: params[:by_domain])
end
2017-09-13 03:30:07 -07:00
def filter_params
params.permit(
:domain_name
)
end
end
end