The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

44 lines
938 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class InstancesController < BaseController
  4. def index
  5. authorize :instance, :index?
  6. @instances = ordered_instances
  7. end
  8. def resubscribe
  9. authorize :instance, :resubscribe?
  10. params.require(:by_domain)
  11. Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
  12. redirect_to admin_instances_path
  13. end
  14. private
  15. def filtered_instances
  16. InstanceFilter.new(filter_params).results
  17. end
  18. def paginated_instances
  19. filtered_instances.page(params[:page])
  20. end
  21. helper_method :paginated_instances
  22. def ordered_instances
  23. paginated_instances.map { |account| Instance.new(account) }
  24. end
  25. def subscribeable_accounts
  26. Account.remote.where(protocol: :ostatus).where(domain: params[:by_domain])
  27. end
  28. def filter_params
  29. params.permit(
  30. :domain_name
  31. )
  32. end
  33. end
  34. end