Send Notifications when participation approval

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-06-08 12:28:19 +02:00
parent 63efea7371
commit 3e74f59ee8
38 changed files with 2500 additions and 973 deletions

View File

@@ -7,7 +7,7 @@ defmodule Mobilizon.Web.Email.Notification do
import Bamboo.Phoenix
import Mobilizon.Web.Gettext
alias Mobilizon.Events.Participant
alias Mobilizon.Events.{Event, Participant}
alias Mobilizon.Users.{Setting, User}
alias Mobilizon.Web.{Email, Gettext}
@@ -80,4 +80,28 @@ defmodule Mobilizon.Web.Email.Notification do
|> assign(:subject, subject)
|> render(:notification_each_week)
end
def pending_participation_notification(
%User{locale: locale, email: email},
%Event{} = event,
total
) do
Gettext.put_locale(locale)
subject =
ngettext(
"One participation request for event %{title} to process",
"%{number_participation_requests} participation requests for event %{title} to process",
total,
number_participation_requests: total,
title: event.title
)
Email.base_email(to: email, subject: subject)
|> assign(:locale, locale)
|> assign(:event, event)
|> assign(:total, total)
|> assign(:subject, subject)
|> render(:pending_participation_notification)
end
end