From e39558a7dd0a46ac558b28d99f6f0b13f848080a Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 18 Sep 2023 19:06:27 -0400 Subject: [PATCH] fix: undo previous change for `only_touched?` on form submit --- lib/ash_phoenix/form/form.ex | 10 +--------- lib/ash_phoenix/form/wrapped_value.ex | 1 + lib/ash_phoenix/gen/live.ex | 9 ++++++--- mix.exs | 5 ++++- test/support/resources/foo.ex | 1 + test/support/resources/union_value.ex | 1 + 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/ash_phoenix/form/form.ex b/lib/ash_phoenix/form/form.ex index ba9ef41..110c446 100644 --- a/lib/ash_phoenix/form/form.ex +++ b/lib/ash_phoenix/form/form.ex @@ -1566,13 +1566,6 @@ defmodule AshPhoenix.Form do type: {:fun, 1}, doc: "A function to apply to the source (changeset or query) just before submitting the action. Must return the modified changeset." - ], - only_touched?: [ - type: :boolean, - default: false, - doc: """ - If set to true, only fields that have been marked as touched will be used. - """ ] ] @@ -1661,8 +1654,7 @@ defmodule AshPhoenix.Form do end changeset_params = - opts[:override_params] || - params(form, only_touched?: Keyword.get(opts, :only_touched?, false)) + opts[:override_params] || params(form) prepare_source = form.prepare_source || (& &1) diff --git a/lib/ash_phoenix/form/wrapped_value.ex b/lib/ash_phoenix/form/wrapped_value.ex index c4a304f..8b4eac8 100644 --- a/lib/ash_phoenix/form/wrapped_value.ex +++ b/lib/ash_phoenix/form/wrapped_value.ex @@ -1,4 +1,5 @@ defmodule AshPhoenix.Form.WrappedValue do + @moduledoc "A sentinal value used when editing a union that has non-map values" use Ash.Resource, data_layer: :embedded diff --git a/lib/ash_phoenix/gen/live.ex b/lib/ash_phoenix/gen/live.ex index c2ca2ae..2a7ec5d 100644 --- a/lib/ash_phoenix/gen/live.ex +++ b/lib/ash_phoenix/gen/live.ex @@ -1,4 +1,6 @@ defmodule AshPhoenix.Gen.Live do + @moduledoc false + def generate_from_cli(argv) do if Mix.Project.umbrella?() do Mix.raise( @@ -209,6 +211,7 @@ defmodule AshPhoenix.Gen.Live do |> Ash.Resource.Info.public_attributes() end + # sobelow_skip ["DOS.BinToAtom"] defp action(resource, opts, type) do action = case opts[:"#{type}_action"] do @@ -361,18 +364,18 @@ defmodule AshPhoenix.Gen.Live do end end - defp web_path() do + defp web_path do web_module().module_info[:compile][:source] |> Path.relative_to(root_path()) |> Path.rootname() end - defp root_path() do + defp root_path do Mix.Project.get().module_info[:compile][:source] |> Path.dirname() end - defp web_module() do + defp web_module do base = Mix.Phoenix.base() cond do diff --git a/mix.exs b/mix.exs index ea4d512..58d96db 100644 --- a/mix.exs +++ b/mix.exs @@ -152,7 +152,10 @@ defmodule AshPhoenix.MixProject do defp aliases do [ - docs: ["docs", "ash.replace_doc_links"] + docs: ["docs", "ash.replace_doc_links"], + sobelow: + "sobelow --skip -i Config.Secrets --ignore-files lib/ash_phoenix/gen/live.ex" + ] end end diff --git a/test/support/resources/foo.ex b/test/support/resources/foo.ex index 25fa287..1c00929 100644 --- a/test/support/resources/foo.ex +++ b/test/support/resources/foo.ex @@ -1,4 +1,5 @@ defmodule AshPhoenix.Test.Foo do + @moduledoc false use Ash.Resource, data_layer: :embedded attributes do diff --git a/test/support/resources/union_value.ex b/test/support/resources/union_value.ex index 4c4e666..b9cd474 100644 --- a/test/support/resources/union_value.ex +++ b/test/support/resources/union_value.ex @@ -1,4 +1,5 @@ defmodule AshPhoenix.Test.UnionValue do + @moduledoc false use Ash.Type.NewType, subtype_of: :union, constraints: [