From 36cdcaa864af1819736dc4dd8e73c593b1ba95fe Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 30 Sep 2020 10:45:01 +0200 Subject: [PATCH] Send all event reminder notifications Signed-off-by: Thomas Citharel --- lib/federation/activity_pub/activity_pub.ex | 2 +- lib/graphql/resolvers/participant.ex | 2 +- lib/service/notifications/scheduler.ex | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/federation/activity_pub/activity_pub.ex b/lib/federation/activity_pub/activity_pub.ex index f90c57eba..48be253b9 100644 --- a/lib/federation/activity_pub/activity_pub.ex +++ b/lib/federation/activity_pub/activity_pub.ex @@ -872,7 +872,7 @@ defmodule Mobilizon.Federation.ActivityPub do event_person_participation_changed: participant.actor.id ), {:ok, _} <- - Scheduler.before_event_notification(participant), + Scheduler.trigger_notifications_for_participant(participant), participant_as_data <- Convertible.model_to_as(participant), audience <- Audience.calculate_to_and_cc_from_mentions(participant), diff --git a/lib/graphql/resolvers/participant.ex b/lib/graphql/resolvers/participant.ex index 24060a588..472e79a3a 100644 --- a/lib/graphql/resolvers/participant.ex +++ b/lib/graphql/resolvers/participant.ex @@ -136,7 +136,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Participant do end @doc """ - Leave an event for an actor + Leave an event for an anonymous actor """ def actor_leave_event( _parent, diff --git a/lib/service/notifications/scheduler.ex b/lib/service/notifications/scheduler.ex index 902e1e689..c369b7b8e 100644 --- a/lib/service/notifications/scheduler.ex +++ b/lib/service/notifications/scheduler.ex @@ -10,6 +10,14 @@ defmodule Mobilizon.Service.Notifications.Scheduler do alias Mobilizon.Users.{Setting, User} require Logger + @spec trigger_notifications_for_participant(Participant.t()) :: {:ok, nil} + def trigger_notifications_for_participant(%Participant{} = participant) do + before_event_notification(participant) + on_day_notification(participant) + weekly_notification(participant) + {:ok, nil} + end + def before_event_notification(%Participant{ id: participant_id, event: %Event{begins_on: begins_on},