0
0
Fork 0

Add ability to select all accounts matching search for batch actions (#19053)

This commit is contained in:
Eugen Rochko 2022-08-25 23:33:34 +02:00 committed by GitHub
parent d696f729f1
commit 5b0e8cc92b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 138 additions and 4 deletions

View file

@ -6,7 +6,8 @@ class Form::AccountBatch
include AccountableConcern
include Payloadable
attr_accessor :account_ids, :action, :current_account
attr_accessor :account_ids, :action, :current_account,
:select_all_matching, :query
def save
case action
@ -60,7 +61,11 @@ class Form::AccountBatch
end
def accounts
Account.where(id: account_ids)
if select_all_matching?
query
else
Account.where(id: account_ids)
end
end
def approve!
@ -118,4 +123,8 @@ class Form::AccountBatch
log_action(:approve, account.user)
account.user.approve!
end
def select_all_matching?
select_all_matching == '1'
end
end