Fix events being not distinct
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
4f7faf4f4c
commit
f9e14c3a93
|
@ -349,7 +349,7 @@ defmodule Mobilizon.Events do
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of events.
|
Returns the list of events.
|
||||||
"""
|
"""
|
||||||
@spec list_events(integer | nil, integer | nil, atom, atom, boolean) :: [Event.t()]
|
@spec list_events(integer | nil, integer | nil, atom, atom, boolean) :: Page.t()
|
||||||
def list_events(
|
def list_events(
|
||||||
page \\ nil,
|
page \\ nil,
|
||||||
limit \\ nil,
|
limit \\ nil,
|
||||||
|
@ -357,7 +357,7 @@ defmodule Mobilizon.Events do
|
||||||
direction \\ :asc,
|
direction \\ :asc,
|
||||||
is_future \\ true
|
is_future \\ true
|
||||||
) do
|
) do
|
||||||
query = from(e in Event, preload: [:organizer_actor, :participants])
|
query = from(e in Event, distinct: true, preload: [:organizer_actor, :participants])
|
||||||
|
|
||||||
query
|
query
|
||||||
|> sort(sort, direction)
|
|> sort(sort, direction)
|
||||||
|
@ -365,7 +365,7 @@ defmodule Mobilizon.Events do
|
||||||
|> filter_public_visibility()
|
|> filter_public_visibility()
|
||||||
|> filter_draft()
|
|> filter_draft()
|
||||||
|> filter_local_or_from_followed_instances_events()
|
|> filter_local_or_from_followed_instances_events()
|
||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit, :begins_on)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec stream_events_for_sitemap :: Enum.t()
|
@spec stream_events_for_sitemap :: Enum.t()
|
||||||
|
|
Loading…
Reference in a new issue