Filter out cancelled events on homepage
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
ad0086032b
commit
766b452640
@ -364,6 +364,7 @@ defmodule Mobilizon.Events do
|
|||||||
|> filter_future_events(is_future)
|
|> filter_future_events(is_future)
|
||||||
|> filter_public_visibility()
|
|> filter_public_visibility()
|
||||||
|> filter_draft()
|
|> filter_draft()
|
||||||
|
|> filter_cancelled_events()
|
||||||
|> filter_local_or_from_followed_instances_events()
|
|> filter_local_or_from_followed_instances_events()
|
||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit)
|
||||||
end
|
end
|
||||||
@ -1655,6 +1656,15 @@ defmodule Mobilizon.Events do
|
|||||||
from(e in query, where: e.draft == ^is_draft)
|
from(e in query, where: e.draft == ^is_draft)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec filter_cancelled_events(Ecto.Query.t(), boolean()) :: Ecto.Query.t()
|
||||||
|
defp filter_cancelled_events(query, hide_cancelled \\ true)
|
||||||
|
|
||||||
|
defp filter_cancelled_events(query, false), do: query
|
||||||
|
|
||||||
|
defp filter_cancelled_events(query, true) do
|
||||||
|
from(e in query, where: e.status != ^:cancelled)
|
||||||
|
end
|
||||||
|
|
||||||
@spec filter_future_events(Ecto.Query.t(), boolean) :: Ecto.Query.t()
|
@spec filter_future_events(Ecto.Query.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,
|
||||||
|
Loading…
Reference in New Issue
Block a user