manager: fix the deletion email not being sent (#4097)

Manager : corrige l'email notifiant la suppression, qui n'était plus envoyé à l'usager
This commit is contained in:
Pierre de La Morinerie 2019-07-15 11:21:26 +02:00 committed by GitHub
commit 216aabf55b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -22,9 +22,8 @@ module Manager
def hide
dossier = Dossier.find(params[:id])
deleted_dossier = dossier.hide!(current_administration)
dossier.hide!(current_administration)
DossierMailer.notify_deletion_to_user(deleted_dossier, dossier.user.email).deliver_later
logger.info("Le dossier #{dossier.id} est supprimé par #{current_administration.email}")
flash[:notice] = "Le dossier #{dossier.id} est supprimé"

View file

@ -412,7 +412,8 @@ class Dossier < ApplicationRecord
def hide!(administration)
update(hidden_at: Time.zone.now)
DeletedDossier.create_from_dossier(self)
deleted_dossier = DeletedDossier.create_from_dossier(self)
DossierMailer.notify_deletion_to_user(deleted_dossier, user.email).deliver_later
log_dossier_operation(administration, :supprimer, self)
end