feat(groupe instructeur mailer): make two kind of notifications for removed instructeur

This commit is contained in:
Eric Leroy-Terquem 2023-02-15 11:57:35 +01:00
parent 5be58c8223
commit a46faf8cdf
10 changed files with 66 additions and 44 deletions

View file

@ -146,19 +146,18 @@ module Administrateurs
instructeur = groupe_instructeur.instructeurs.find_by(id: instructeur_id)
if groupe_instructeur.remove(instructeur)
flash[:notice] = if procedure.routing_enabled?
GroupeInstructeurMailer
.notify_removed_instructeurs(groupe_instructeur, [instructeur], current_administrateur.email)
.deliver_later
GroupeInstructeurMailer
.notify_group_when_instructeurs_removed(groupe_instructeur, [instructeur], current_administrateur.email)
.deliver_later
flash[:notice] = if instructeur.in?(procedure.instructeurs)
"Linstructeur « #{instructeur.email} » a été retiré du groupe."
else
"Linstructeur a bien été désaffecté de la démarche"
end
GroupeInstructeurMailer
.notify_removed_instructeur(groupe_instructeur, instructeur, current_administrateur.email)
.deliver_later
GroupeInstructeurMailer
.notify_group_when_instructeurs_removed(groupe_instructeur, [instructeur], current_administrateur.email)
.deliver_later
else
flash[:alert] = if procedure.routing_enabled?
if instructeur.present?

View file

@ -35,7 +35,7 @@ module Instructeurs
if groupe_instructeur.remove(instructeur)
flash[:notice] = "Linstructeur « #{instructeur.email} » a été retiré du groupe."
GroupeInstructeurMailer
.notify_removed_instructeurs(groupe_instructeur, [instructeur], current_user.email)
.notify_removed_instructeur(groupe_instructeur, instructeur, current_user.email)
.deliver_later
GroupeInstructeurMailer