Merge branch 'order-upcoming-my-group-events' into 'main'

Order my group upcoming events by begins_on

See merge request framasoft/mobilizon!1122
This commit is contained in:
Thomas Citharel 2021-11-24 08:59:47 +00:00
commit ef954569f4

View file

@ -16,7 +16,7 @@ defmodule Mobilizon.FollowedGroupActivity do
) :: Page.t(Event.t())
def user_followed_group_events(user_id, after_datetime \\ nil, page \\ nil, limit \\ nil) do
Event
|> distinct([e], e.id)
|> distinct([e], [e.begins_on, e.id])
|> join(:left, [e], p in Participant, on: e.id == p.event_id)
|> join(:inner, [_e, p], pa in Actor, on: p.actor_id == pa.id)
|> join(:inner, [e], g in Actor, on: e.attributed_to_id == g.id)