aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/controller_helper.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivant.business@gmail.com>2019-04-02 14:05:34 +0300
committerIvan Tashkinov <ivant.business@gmail.com>2019-04-02 14:05:34 +0300
commit37925cbe78b7fc73f28cc85ffcf1e16fb00f7a24 (patch)
tree2e3f848e697426f4b79d8e02a2ba20df12368ca9 /lib/pleroma/web/controller_helper.ex
parent590c935d95f0ea4fb65994027a88a0623527af88 (diff)
parent091baf93169895c62418ccee81b80d00416aaa56 (diff)
downloadpleroma-37925cbe78b7fc73f28cc85ffcf1e16fb00f7a24.tar.gz
Merge remote-tracking branch 'remotes/upstream/develop' into twitter_oauth
# Conflicts: # lib/pleroma/web/oauth/oauth_controller.ex # lib/pleroma/web/router.ex
Diffstat (limited to 'lib/pleroma/web/controller_helper.ex')
-rw-r--r--lib/pleroma/web/controller_helper.ex5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex
index 4d6192db0..181483664 100644
--- a/lib/pleroma/web/controller_helper.ex
+++ b/lib/pleroma/web/controller_helper.ex
@@ -5,6 +5,11 @@
defmodule Pleroma.Web.ControllerHelper do
use Pleroma.Web, :controller
+ # 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 oauth_scopes(params, default) do
# Note: `scopes` is used by Mastodon — supporting it but sticking to
# OAuth's standard `scope` wherever we control it