Recompilation speedup: break out Pleroma.Web.Params.truthy_param?/1 from ControllerHelper
In web browsers, the value of an HTML checkbox input is usually "on"
or "off"
(a string) rather than true
/false
. This can pose a problem for backend servers who need to then interpret boolean params in a request.
The function ControllerHelper.truthy_param?/1
exists to convert boolean params from browsers into native Elixir booleans true
/false
.
However, this function is used by more than just controllers. When used by ApiSpec.Schemas.BooleanLike
, it creates a cycle on Pleroma.Web (use
'd by ControllerHelper).
For a simple function with no dependencies, it's better off in its own module, so I created Pleroma.Web.Params
for it. And now its purpose is more clear when used outside of controller modules.
This gets rid of a cycle and reduces most others: https://www.diffchecker.com/CqMAcUcO