From e1d0390e29b60a6fa06d91a5d33dfb0e81fe7dd7 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 6 Apr 2019 17:53:45 +0200 Subject: Add batch actions for approving and rejecting pending accounts (#10469) --- config/routes.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'config/routes.rb') diff --git a/config/routes.rb b/config/routes.rb index a98dbb700..1ea6490b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -214,6 +214,13 @@ Rails.application.routes.draw do end end + resources :pending_accounts, only: [:index, :update] do + collection do + post :approve_all + post :reject_all + end + end + resources :users, only: [] do resource :two_factor_authentication, only: [:destroy] end -- cgit From 5247ea4efd3683154d52efe4385bdbb63f476943 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 8 Apr 2019 18:35:41 +0200 Subject: Fix batch actions not working on pending accounts (#10508) --- app/controllers/admin/pending_accounts_controller.rb | 4 ++-- app/views/admin/pending_accounts/index.html.haml | 2 +- config/locales/en.yml | 1 + config/routes.rb | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'config/routes.rb') diff --git a/app/controllers/admin/pending_accounts_controller.rb b/app/controllers/admin/pending_accounts_controller.rb index 8429d3585..f145108b3 100644 --- a/app/controllers/admin/pending_accounts_controller.rb +++ b/app/controllers/admin/pending_accounts_controller.rb @@ -8,11 +8,11 @@ module Admin @form = Form::AccountBatch.new end - def update + def batch @form = Form::AccountBatch.new(form_account_batch_params.merge(current_account: current_account, action: action_from_button)) @form.save rescue ActionController::ParameterMissing - # Do nothing + flash[:alert] = I18n.t('admin.accounts.no_account_selected') ensure redirect_to admin_pending_accounts_path(current_params) end diff --git a/app/views/admin/pending_accounts/index.html.haml b/app/views/admin/pending_accounts/index.html.haml index 77b96cbca..7ce5b8213 100644 --- a/app/views/admin/pending_accounts/index.html.haml +++ b/app/views/admin/pending_accounts/index.html.haml @@ -4,7 +4,7 @@ - content_for :header_tags do = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous' -= form_for(@form, url: admin_pending_accounts_path, method: :patch) do |f| += form_for(@form, url: batch_admin_pending_accounts_path) do |f| = hidden_field_tag :page, params[:page] || 1 .batch-table diff --git a/config/locales/en.yml b/config/locales/en.yml index e56008a89..139803aff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -134,6 +134,7 @@ en: moderation_notes: Moderation notes most_recent_activity: Most recent activity most_recent_ip: Most recent IP + no_account_selected: No accounts were changed as none were selected no_limits_imposed: No limits imposed not_subscribed: Not subscribed outbox_url: Outbox URL diff --git a/config/routes.rb b/config/routes.rb index 1ea6490b0..34d0081e7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -214,10 +214,11 @@ Rails.application.routes.draw do end end - resources :pending_accounts, only: [:index, :update] do + resources :pending_accounts, only: [:index] do collection do post :approve_all post :reject_all + post :batch end end -- cgit