From bcf6fd893c762c12b63d7e02da43cd5c05db509b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 19 Apr 2023 11:56:41 +0200 Subject: [PATCH] fix(backend): Fix Mobilizon.Events.list_participations_for_user_query/1 Multiple on: following two join: declarations were not taken into account Signed-off-by: Thomas Citharel --- lib/mobilizon/events/events.ex | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index 0816d3181..6f109d8d7 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -1755,15 +1755,11 @@ defmodule Mobilizon.Events do @spec list_participations_for_user_query(integer()) :: Ecto.Query.t() defp list_participations_for_user_query(user_id) do - from( - p in Participant, - join: e in Event, - join: a in Actor, - on: p.actor_id == a.id, - on: p.event_id == e.id, - where: a.user_id == ^user_id and p.role != ^:not_approved, - preload: [:event, :actor] - ) + Participant + |> join(:inner, [p], e in Event, on: p.event_id == e.id) + |> join(:inner, [p], a in Actor, on: p.actor_id == a.id) + |> where([p, _e, a], a.user_id == ^user_id and p.role != ^:not_approved) + |> preload([:event, :actor]) end @spec feed_token_query(String.t()) :: Ecto.Query.t()