diff --git a/app/controllers/admin/instances_controller.rb b/app/controllers/admin/instances_controller.rb index ac93248a85..3296e08db8 100644 --- a/app/controllers/admin/instances_controller.rb +++ b/app/controllers/admin/instances_controller.rb @@ -6,15 +6,26 @@ module Admin @instances = ordered_instances end + def resubscribe + params.require(:by_domain) + Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id)) + redirect_to admin_instances_path + end + private def paginated_instances Account.remote.by_domain_accounts.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 end end diff --git a/app/views/admin/instances/_instance.html.haml b/app/views/admin/instances/_instance.html.haml index 5c6783d061..435cd8f642 100644 --- a/app/views/admin/instances/_instance.html.haml +++ b/app/views/admin/instances/_instance.html.haml @@ -3,3 +3,5 @@ = instance.domain %td.count = instance.accounts_count + %td + = table_link_to 'paper-plane-o', t('admin.accounts.resubscribe'), resubscribe_admin_instances_url(by_domain: instance.domain), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/config/routes.rb b/config/routes.rb index 2aa89f16df..072ef79841 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -88,7 +88,12 @@ Rails.application.routes.draw do resources :subscriptions, only: [:index] resources :domain_blocks, only: [:index, :new, :create, :show, :destroy] resource :settings, only: [:edit, :update] - resources :instances, only: [:index] + + resources :instances, only: [:index] do + collection do + post :resubscribe + end + end resources :reports, only: [:index, :show, :update] do resources :reported_statuses, only: [:create, :update, :destroy]