Send all event reminder notifications

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-09-30 10:45:01 +02:00
parent bf553ddca4
commit 493a15cea1
3 changed files with 10 additions and 2 deletions

View File

@ -872,7 +872,7 @@ defmodule Mobilizon.Federation.ActivityPub do
event_person_participation_changed: participant.actor.id event_person_participation_changed: participant.actor.id
), ),
{:ok, _} <- {:ok, _} <-
Scheduler.before_event_notification(participant), Scheduler.trigger_notifications_for_participant(participant),
participant_as_data <- Convertible.model_to_as(participant), participant_as_data <- Convertible.model_to_as(participant),
audience <- audience <-
Audience.calculate_to_and_cc_from_mentions(participant), Audience.calculate_to_and_cc_from_mentions(participant),

View File

@ -136,7 +136,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Participant do
end end
@doc """ @doc """
Leave an event for an actor Leave an event for an anonymous actor
""" """
def actor_leave_event( def actor_leave_event(
_parent, _parent,

View File

@ -10,6 +10,14 @@ defmodule Mobilizon.Service.Notifications.Scheduler do
alias Mobilizon.Users.{Setting, User} alias Mobilizon.Users.{Setting, User}
require Logger 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{ def before_event_notification(%Participant{
id: participant_id, id: participant_id,
event: %Event{begins_on: begins_on}, event: %Event{begins_on: begins_on},