logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

instances_controller.rb (927B)


  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.with_followers.remote.where(domain: params[:by_domain])
  27. end
  28. def filter_params
  29. params.permit(
  30. :domain_name
  31. )
  32. end
  33. end
  34. end