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.

31 lines
701 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class InstancesController < BaseController
  4. def index
  5. @instances = ordered_instances
  6. end
  7. def resubscribe
  8. params.require(:by_domain)
  9. Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
  10. redirect_to admin_instances_path
  11. end
  12. private
  13. def paginated_instances
  14. Account.remote.by_domain_accounts.page(params[:page])
  15. end
  16. helper_method :paginated_instances
  17. def ordered_instances
  18. paginated_instances.map { |account| Instance.new(account) }
  19. end
  20. def subscribeable_accounts
  21. Account.with_followers.remote.where(domain: params[:by_domain])
  22. end
  23. end
  24. end