2017-04-18 21:09:07 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class InstancesController < BaseController
|
|
|
|
def index
|
2017-05-31 20:38:44 +02:00
|
|
|
@instances = ordered_instances
|
2017-04-18 21:09:07 +02:00
|
|
|
end
|
|
|
|
|
2017-07-20 23:07:13 +02:00
|
|
|
def resubscribe
|
|
|
|
params.require(:by_domain)
|
|
|
|
Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
|
|
|
|
redirect_to admin_instances_path
|
|
|
|
end
|
|
|
|
|
2017-04-18 21:09:07 +02:00
|
|
|
private
|
|
|
|
|
2017-05-31 20:38:44 +02:00
|
|
|
def paginated_instances
|
|
|
|
Account.remote.by_domain_accounts.page(params[:page])
|
|
|
|
end
|
2017-07-20 23:07:13 +02:00
|
|
|
|
2017-05-31 20:38:44 +02:00
|
|
|
helper_method :paginated_instances
|
|
|
|
|
2017-04-18 21:09:07 +02:00
|
|
|
def ordered_instances
|
2017-05-31 20:38:44 +02:00
|
|
|
paginated_instances.map { |account| Instance.new(account) }
|
2017-04-18 21:09:07 +02:00
|
|
|
end
|
2017-07-20 23:07:13 +02:00
|
|
|
|
|
|
|
def subscribeable_accounts
|
|
|
|
Account.with_followers.remote.where(domain: params[:by_domain])
|
|
|
|
end
|
2017-04-18 21:09:07 +02:00
|
|
|
end
|
|
|
|
end
|