Move CommentairesController#notify_user_user_with_mail to Commentaire

This commit is contained in:
gregoirenovel 2017-05-12 13:40:32 +02:00
parent cae3e1f420
commit 9c3cde2b2e
3 changed files with 6 additions and 33 deletions

View file

@ -5,6 +5,7 @@ class Commentaire < ActiveRecord::Base
belongs_to :piece_justificative
after_save :notify_gestionnaires
after_save :notify_user_with_mail
def header
"#{email}, " + I18n.l(created_at.localtime, format: '%d %b %Y %H:%M')
@ -17,4 +18,8 @@ class Commentaire < ActiveRecord::Base
NotificationService.new('commentaire', self.dossier.id).notify
end
end
def notify_user_with_mail
NotificationMailer.new_answer(dossier).deliver_now! unless (current_user.try(:email) == dossier.user.email || email == 'contact@tps.apientreprise.fr')
end
end