about summary refs log tree commit diff
path: root/app/controllers/admin/pending_accounts_controller.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-04-10 22:33:41 +0200
committerGitHub <noreply@github.com>2019-04-10 22:33:41 +0200
commit31e4fcb006c6ef2d8e1a4c765e897afa1cba1b5c (patch)
tree15a022b1b44f72fee2d83cfe6f8355b7334f9d9b /app/controllers/admin/pending_accounts_controller.rb
parentcb410f80a40d03b509cec244b0cdd4ed3957c6a0 (diff)
parent2f422b708f75bea87a49eb879ec3e0c3f35c2f9b (diff)
Merge pull request #985 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/admin/pending_accounts_controller.rb')
-rw-r--r--app/controllers/admin/pending_accounts_controller.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/admin/pending_accounts_controller.rb b/app/controllers/admin/pending_accounts_controller.rb
index 8429d3585..b62a9bc84 100644
--- a/app/controllers/admin/pending_accounts_controller.rb
+++ b/app/controllers/admin/pending_accounts_controller.rb
@@ -8,29 +8,29 @@ 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
 
     def approve_all
-      Form::AccountBatch.new(account_ids: User.pending.pluck(:account_id), action: 'approve').save
+      Form::AccountBatch.new(current_account: current_account, account_ids: User.pending.pluck(:account_id), action: 'approve').save
       redirect_to admin_pending_accounts_path(current_params)
     end
 
     def reject_all
-      Form::AccountBatch.new(account_ids: User.pending.pluck(:account_id), action: 'reject').save
+      Form::AccountBatch.new(current_account: current_account, account_ids: User.pending.pluck(:account_id), action: 'reject').save
       redirect_to admin_pending_accounts_path(current_params)
     end
 
     private
 
     def set_accounts
-      @accounts = Account.joins(:user).merge(User.pending).page(params[:page])
+      @accounts = Account.joins(:user).merge(User.pending.recent).includes(user: :invite_request).page(params[:page])
     end
 
     def form_account_batch_params