Skip to content

Commit

Permalink
fix default component schema attrs
Browse files Browse the repository at this point in the history
- the defaults weren't working correctly because it was trying to
  call Kernel.function_exported? with binary strings instead of atoms
- so it would always present the Bandit.Pipeline as default
- adds checks similar to the form validation
- driveby fixes Gettext deprecated compiler warning
  • Loading branch information
inf-rno committed Oct 24, 2024
1 parent bac4e0e commit 6925f56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/flame_on/component/capture_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ defmodule FlameOn.Component.CaptureSchema do
:rpc.call(node, Code, :ensure_loaded?, [module])
end

defp rpc_function_exported?(module, function, arity, node) when is_binary(module) and is_binary(function) do
{module, function} = {rpc_to_existing_atom(module, node), rpc_to_existing_atom(function, node)}
if is_nil(module) || !rpc_code_ensure_loaded?(module, node) || is_nil(function) do
false
else
rpc_function_exported?(module, function, arity, node)
end
end

defp rpc_function_exported?(module, function, arity, node) do
:rpc.call(node, Kernel, :function_exported?, [module, function, arity])
end
Expand Down
2 changes: 1 addition & 1 deletion lib/flame_on/gettext.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ defmodule FlameOn.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :flame_on
use Gettext.Backend, otp_app: :flame_on
end

0 comments on commit 6925f56

Please sign in to comment.