diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-11-14 08:06:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 08:06:06 +0100 |
commit | b31afc62943b79bf97338040e39123b9dd68f31f (patch) | |
tree | f6d442f3e51147e365e1197e07c3e6548a1d4992 /app/models/admin | |
parent | 5c826c408db86c3b4abf4959c092ad4c5c807896 (diff) |
Fix error when passing unknown filter param in REST API (#20626)
Fix #19156
Diffstat (limited to 'app/models/admin')
-rw-r--r-- | app/models/admin/action_log_filter.rb | 2 | ||||
-rw-r--r-- | app/models/admin/appeal_filter.rb | 4 | ||||
-rw-r--r-- | app/models/admin/status_filter.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/models/admin/action_log_filter.rb b/app/models/admin/action_log_filter.rb index edb391e2e..f89d452ef 100644 --- a/app/models/admin/action_log_filter.rb +++ b/app/models/admin/action_log_filter.rb @@ -95,7 +95,7 @@ class Admin::ActionLogFilter account = Account.find_or_initialize_by(id: value) Admin::ActionLog.where(target: [account, account.user].compact) else - raise "Unknown filter: #{key}" + raise Mastodon::InvalidParameterError, "Unknown filter: #{key}" end end end diff --git a/app/models/admin/appeal_filter.rb b/app/models/admin/appeal_filter.rb index b163d2e56..f5dcc0f54 100644 --- a/app/models/admin/appeal_filter.rb +++ b/app/models/admin/appeal_filter.rb @@ -30,7 +30,7 @@ class Admin::AppealFilter when 'status' status_scope(value) else - raise "Unknown filter: #{key}" + raise Mastodon::InvalidParameterError, "Unknown filter: #{key}" end end @@ -43,7 +43,7 @@ class Admin::AppealFilter when 'pending' Appeal.pending else - raise "Unknown status: #{value}" + raise Mastodon::InvalidParameterError, "Unknown status: #{value}" end end end diff --git a/app/models/admin/status_filter.rb b/app/models/admin/status_filter.rb index d7a16f760..4d439e9a1 100644 --- a/app/models/admin/status_filter.rb +++ b/app/models/admin/status_filter.rb @@ -32,7 +32,7 @@ class Admin::StatusFilter when 'media' Status.joins(:media_attachments).merge(@account.media_attachments.reorder(nil)).group(:id).reorder('statuses.id desc') else - raise "Unknown filter: #{key}" + raise Mastodon::InvalidParameterError, "Unknown filter: #{key}" end end end |