aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/controller_helper.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-17 12:14:49 +0200
committerlain <lain@soykaf.club>2020-05-17 12:14:49 +0200
commit9c171097653abce49b9847fff66bc39b35719a1c (patch)
treee89ab9245f0844bfb3334f62f67f8ab9f0949580 /lib/pleroma/web/controller_helper.ex
parentf012c3a202ef43d1a8a1dc88f08057b7a41d3d78 (diff)
parentb0ccdb5af4baa119b336298d38f34746cdce0111 (diff)
downloadpleroma-9c171097653abce49b9847fff66bc39b35719a1c.tar.gz
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
Diffstat (limited to 'lib/pleroma/web/controller_helper.ex')
-rw-r--r--lib/pleroma/web/controller_helper.ex21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex
index eb97ae975..5a1316a5f 100644
--- a/lib/pleroma/web/controller_helper.ex
+++ b/lib/pleroma/web/controller_helper.ex
@@ -5,8 +5,6 @@
defmodule Pleroma.Web.ControllerHelper do
use Pleroma.Web, :controller
- alias Pleroma.Config
-
# As in Mastodon API, per https://api.rubyonrails.org/classes/ActiveModel/Type/Boolean.html
@falsy_param_values [false, 0, "0", "f", "F", "false", "False", "FALSE", "off", "OFF"]
@@ -106,13 +104,16 @@ defmodule Pleroma.Web.ControllerHelper do
def put_if_exist(map, key, value), do: Map.put(map, key, value)
- @doc "Whether to skip rendering `[:account][:pleroma][:relationship]`for statuses/notifications"
- def skip_relationships?(params) do
- if Config.get([:extensions, :output_relationships_in_statuses_by_default]) do
- false
- else
- # BREAKING: older PleromaFE versions do not send this param but _do_ expect relationships.
- not truthy_param?(params["with_relationships"])
- end
+ @doc """
+ Returns true if request specifies to include embedded relationships in account objects.
+ May only be used in selected account-related endpoints; has no effect for status- or
+ notification-related endpoints.
+ """
+ # Intended for PleromaFE: https://git.pleroma.social/pleroma/pleroma-fe/-/issues/838
+ def embed_relationships?(params) do
+ # To do once OpenAPI transition mess is over: just `truthy_param?(params[:with_relationships])`
+ params
+ |> Map.get(:with_relationships, params["with_relationships"])
+ |> truthy_param?()
end
end