Fix changed filter params in admin APIs
Fix approve and reject actions not being logged from individual actions
This commit is contained in:
parent
d78ddb1cea
commit
5b5cc4b3fa
58 changed files with 83 additions and 91 deletions
|
@ -21,7 +21,7 @@ class AccountFilter
|
|||
end
|
||||
|
||||
def results
|
||||
scope = Account.includes(:account_stat, user: [:session_activations, :invite_request]).without_instance_actor.reorder(nil)
|
||||
scope = Account.includes(:account_stat, user: [:ips, :invite, :invite_request]).without_instance_actor.reorder(nil)
|
||||
|
||||
params.each do |key, value|
|
||||
scope.merge!(scope_for(key, value.to_s.strip)) if value.present?
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
class ReportFilter
|
||||
KEYS = %i(
|
||||
resolved
|
||||
status
|
||||
account_id
|
||||
target_account_id
|
||||
by_target_domain
|
||||
target_domain
|
||||
target_origin
|
||||
).freeze
|
||||
|
||||
|
@ -16,7 +16,7 @@ class ReportFilter
|
|||
end
|
||||
|
||||
def results
|
||||
scope = Report.unresolved
|
||||
scope = Report.order(id: :desc)
|
||||
|
||||
params.each do |key, value|
|
||||
scope = scope.merge scope_for(key, value)
|
||||
|
@ -27,10 +27,10 @@ class ReportFilter
|
|||
|
||||
def scope_for(key, value)
|
||||
case key.to_sym
|
||||
when :by_target_domain
|
||||
when :target_domain
|
||||
Report.where(target_account: Account.where(domain: value))
|
||||
when :resolved
|
||||
Report.resolved
|
||||
when :status
|
||||
status_scope(value)
|
||||
when :account_id
|
||||
Report.where(account_id: value)
|
||||
when :target_account_id
|
||||
|
@ -52,4 +52,15 @@ class ReportFilter
|
|||
raise "Unknown value: #{value}"
|
||||
end
|
||||
end
|
||||
|
||||
def status_scope(value)
|
||||
case value.to_sym
|
||||
when :resolved
|
||||
Report.resolved
|
||||
when :unresolved
|
||||
Report.unresolved
|
||||
else
|
||||
raise "Unknown value: #{value}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue