Merge branch 'respect-endtime' into 'main'

Display events on startpage until their end time, unless they have no end time

See merge request framasoft/mobilizon!1423
This commit is contained in:
Thomas Citharel 2023-08-11 10:01:25 +00:00
commit 45a1a3a2dd

View File

@ -1860,7 +1860,7 @@ defmodule Mobilizon.Events do
@spec filter_future_events(Ecto.Queryable.t(), boolean) :: Ecto.Query.t() @spec filter_future_events(Ecto.Queryable.t(), boolean) :: Ecto.Query.t()
defp filter_future_events(query, true) do defp filter_future_events(query, true) do
from(q in query, from(q in query,
where: q.begins_on > ^DateTime.utc_now() where: coalesce(q.ends_on, q.begins_on) > ^DateTime.utc_now()
) )
end end