0
0
Fork 0

Ensure that boolean params in the API are parsed for truthiness (#6575)

Use Rails smart boolean cast to account for values such as "f",
"0", "false", etc. Previously, if a param was present in the request,
it would count as true.
This commit is contained in:
Eugen Rochko 2018-03-01 02:47:59 +01:00 committed by GitHub
parent 47bdb9b33b
commit fce8464077
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 17 deletions

View file

@ -33,12 +33,8 @@ class Api::V1::SearchController < Api::BaseController
SearchService.new.call(
params[:q],
RESULTS_LIMIT,
resolving_search?,
truthy_param?(:resolve),
current_account
)
end
def resolving_search?
params[:resolve] == 'true'
end
end