Skip to content

Commit

Permalink
fix: ensure actor is set when calling for_read
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Apr 22, 2024
1 parent 6e2e40d commit 5df05fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/ash/filter/filter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,10 @@ defmodule Ash.Filter do
refs,
Ash.Query.for_read(
last_relationship.destination,
Ash.Resource.Info.primary_action(last_relationship.destination, :read).name
Ash.Resource.Info.primary_action(last_relationship.destination, :read).name,
actor: actor,
tenant: tenant,
authorize?: authorize?
),
true
)
Expand Down Expand Up @@ -2270,7 +2273,7 @@ defmodule Ash.Filter do
read_action =
aggregate.read_action || Ash.Resource.Info.primary_action!(related, :read).name

with %{valid?: true} = aggregate_query <- Ash.Query.for_read(related, read_action),
with %{valid?: true} = aggregate_query <- Ash.Query.new(related),
%{valid?: true} = aggregate_query <-
Ash.Query.Aggregate.build_query(aggregate_query,
filter: aggregate.filter,
Expand Down Expand Up @@ -2944,7 +2947,7 @@ defmodule Ash.Filter do
read_action =
aggregate.read_action || Ash.Resource.Info.primary_action!(related, :read).name

with %{valid?: true} = aggregate_query <- Ash.Query.for_read(related, read_action),
with %{valid?: true} = aggregate_query <- Ash.Query.new(related),
%{valid?: true} = aggregate_query <-
Ash.Query.Aggregate.build_query(aggregate_query,
filter: aggregate.filter,
Expand Down Expand Up @@ -3543,11 +3546,8 @@ defmodule Ash.Filter do
aggregate = aggregate(context, attribute) ->
agg_related = Ash.Resource.Info.related(related, aggregate.relationship_path)

read_action =
aggregate.read_action || Ash.Resource.Info.primary_action!(agg_related, :read).name

with %{valid?: true} = aggregate_query <-
Ash.Query.for_read(agg_related, read_action),
Ash.Query.new(agg_related),
%{valid?: true} = aggregate_query <-
Ash.Query.Aggregate.build_query(aggregate_query,
filter: aggregate.filter,
Expand Down

0 comments on commit 5df05fa

Please sign in to comment.