mirror of
https://github.com/kikobar/mastodon.git
synced 2024-11-18 13:17:35 +00:00
7bb8b0b2fc
* Add moderator role and add pundit policies for admin actions * Add rake task for turning user into mod and revoking it again * Fix handling of unauthorized exception * Deliver new report e-mails to staff, not just admins * Add promote/demote to admin UI, hide some actions conditionally * Fix unused i18n
44 lines
927 B
Ruby
44 lines
927 B
Ruby
# 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
|
|
|
|
def filtered_instances
|
|
InstanceFilter.new(filter_params).results
|
|
end
|
|
|
|
def paginated_instances
|
|
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.with_followers.remote.where(domain: params[:by_domain])
|
|
end
|
|
|
|
def filter_params
|
|
params.permit(
|
|
:domain_name
|
|
)
|
|
end
|
|
end
|
|
end
|