fix(feeds): Only provide future events in ICS/Atom feeds

Closes #1246

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-04-20 11:30:10 +02:00
parent 5ae2e2254a
commit f3a443138a
3 changed files with 88 additions and 14 deletions

View File

@@ -17,7 +17,7 @@ defmodule Mobilizon.Service.Export.Common do
case Actors.get_actor_by_name(name) do
%Actor{} = actor ->
if Actor.is_public_visibility?(actor) do
%Page{elements: events} = Events.list_public_events_for_actor(actor, 1, limit)
%Page{elements: events} = Events.list_public_upcoming_events_for_actor(actor, 1, limit)
%Page{elements: posts} = Posts.get_public_posts_for_group(actor, 1, limit)
{:ok, actor, events, posts}
else
@@ -108,7 +108,7 @@ defmodule Mobilizon.Service.Export.Common do
@spec fetch_identity_participations(Actor.t(), integer()) :: Page.t(Participant.t())
defp fetch_identity_participations(%Actor{} = actor, limit) do
with %Page{} = page <- Events.list_event_participations_for_actor(actor, 1, limit) do
with %Page{} = page <- Events.list_upcoming_event_participations_for_actor(actor, 1, limit) do
page
end
end