aboutsummaryrefslogtreecommitdiff
path: root/app/models/form/account_batch.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/form/account_batch.rb')
-rw-r--r--app/models/form/account_batch.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/models/form/account_batch.rb b/app/models/form/account_batch.rb
index 98f2cad3e..5cfcf7205 100644
--- a/app/models/form/account_batch.rb
+++ b/app/models/form/account_batch.rb
@@ -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