fix: pass entire private context to related query in lazy?: true

This commit is contained in:
Zach Daniel 2024-07-02 10:24:33 -04:00
parent f7397160b2
commit 17c92bdf3d
4 changed files with 5 additions and 8 deletions

View file

@ -35,8 +35,7 @@ if Mix.env() == :test do
config :ash, :validate_domain_config_inclusion?, false config :ash, :validate_domain_config_inclusion?, false
config :ash, :policies, show_policy_breakdowns?: true config :ash, :policies, show_policy_breakdowns?: true
config :ash, :compatible_foreign_key_types, config :ash, :compatible_foreign_key_types, [
[ {Ash.Type.CiString, Ash.Type.UUID}
{Ash.Type.CiString, Ash.Type.UUID} ]
]
end end

View file

@ -106,9 +106,7 @@ defmodule Ash.Actions.Read.Relationships do
Ash.Domain.Info.related_domain(related_query, relationship, query.domain) Ash.Domain.Info.related_domain(related_query, relationship, query.domain)
) )
|> Ash.Query.set_tenant(query.tenant) |> Ash.Query.set_tenant(query.tenant)
|> Ash.Query.set_context(%{ |> Ash.Query.set_context(%{private: query.context[:private]})}}
private: %{async_limiter: query.context[:private][:async_limiter]}
})}}
else else
related_query(relationship_name, records, related_query, query) related_query(relationship_name, records, related_query, query)
end end

View file

@ -305,7 +305,6 @@ defmodule Ash.Actions.Update do
maybe_is: false maybe_is: false
) do ) do
{:ok, true, changeset} -> {:ok, true, changeset} ->
# foobar
changeset changeset
{:ok, false, error} -> {:ok, false, error} ->

View file

@ -27,6 +27,7 @@ defmodule Ash.Type.UUID do
def cast_input(nil, _), do: {:ok, nil} def cast_input(nil, _), do: {:ok, nil}
def cast_input(%Ash.CiString{string: string}, constraints), do: cast_input(string, constraints) def cast_input(%Ash.CiString{string: string}, constraints), do: cast_input(string, constraints)
def cast_input(value, _) when is_binary(value) do def cast_input(value, _) when is_binary(value) do
case String.valid?(value) do case String.valid?(value) do
true -> Ecto.Type.cast(Ecto.UUID, String.trim(value)) true -> Ecto.Type.cast(Ecto.UUID, String.trim(value))