From 5df05fa82ee264944de155349e1ca6214b7baf54 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 22 Apr 2024 10:04:35 -0400 Subject: [PATCH] fix: ensure actor is set when calling `for_read` --- lib/ash/filter/filter.ex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ash/filter/filter.ex b/lib/ash/filter/filter.ex index f1216d43f..0d77797bc 100644 --- a/lib/ash/filter/filter.ex +++ b/lib/ash/filter/filter.ex @@ -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 ) @@ -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, @@ -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, @@ -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,