X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcontroller_helper.ex;h=55706eeb84a7e843d4ab8c3bd73d8de56febeb12;hb=3a96c29c65f24538d2d6617d5462839b35b99b04;hp=4d6192db03edb5f63eb8bbbc66078c0cb20d5792;hpb=92a0210fb03ca3e0aefe769fb6b0ab7bda6e5336;p=akkoma diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex index 4d6192db0..55706eeb8 100644 --- a/lib/pleroma/web/controller_helper.ex +++ b/lib/pleroma/web/controller_helper.ex @@ -5,11 +5,10 @@ defmodule Pleroma.Web.ControllerHelper do use Pleroma.Web, :controller - def oauth_scopes(params, default) do - # Note: `scopes` is used by Mastodon — supporting it but sticking to - # OAuth's standard `scope` wherever we control it - Pleroma.Web.OAuth.parse_scopes(params["scope"] || params["scopes"], default) - end + # As in MastoAPI, per https://api.rubyonrails.org/classes/ActiveModel/Type/Boolean.html + @falsy_param_values [false, 0, "0", "f", "F", "false", "FALSE", "off", "OFF"] + def truthy_param?(blank_value) when blank_value in [nil, ""], do: nil + def truthy_param?(value), do: value not in @falsy_param_values def json_response(conn, status, json) do conn