Introduce Sitemaps

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-08-12 16:05:34 +02:00
parent 9a0068dfea
commit c56fb710b6
21 changed files with 163 additions and 39 deletions

View File

@@ -366,6 +366,15 @@ defmodule Mobilizon.Events do
|> Repo.all()
end
@spec stream_events_for_sitemap :: Enum.t()
def stream_events_for_sitemap do
Event
|> filter_public_visibility()
|> filter_draft()
|> filter_local()
|> Repo.stream()
end
@doc """
Returns the list of events with the same tags.
"""
@@ -1583,6 +1592,11 @@ defmodule Mobilizon.Events do
defp filter_future_events(query, false), do: query
@spec filter_local(Ecto.Query.t()) :: Ecto.Query.t()
defp filter_local(query) do
where(query, [q], q.local == true)
end
@spec filter_local_or_from_followed_instances_events(Ecto.Query.t()) :: Ecto.Query.t()
defp filter_local_or_from_followed_instances_events(query) do
from(q in query,