Exclude notification for dossier state draft and for accompagnateur comments

This commit is contained in:
Xavier J 2016-12-26 14:38:00 +01:00
parent 33362d1a52
commit 9a0a391c40
6 changed files with 21 additions and 5 deletions

View file

@ -24,6 +24,8 @@ class Cerfa < ActiveRecord::Base
private
def internal_notification
NotificationService.new('cerfa', self.dossier.id).notify
unless dossier.state == 'draft'
NotificationService.new('cerfa', self.dossier.id).notify
end
end
end

View file

@ -52,6 +52,8 @@ class Champ < ActiveRecord::Base
private
def internal_notification
NotificationService.new('champs', self.dossier.id, self.libelle).notify
unless dossier.state == 'draft'
NotificationService.new('champs', self.dossier.id, self.libelle).notify
end
end
end

View file

@ -13,6 +13,8 @@ class Commentaire < ActiveRecord::Base
private
def internal_notification
NotificationService.new('commentaire', self.dossier.id).notify
if email == dossier.user.email || dossier.invites.pluck(:email).to_a.include?(email)
NotificationService.new('commentaire', self.dossier.id).notify
end
end
end

View file

@ -49,6 +49,8 @@ class PieceJustificative < ActiveRecord::Base
private
def internal_notification
NotificationService.new('piece_justificative', self.dossier.id, self.libelle).notify
unless self.type_de_piece_justificative.nil? && dossier.state == 'draft'
NotificationService.new('piece_justificative', self.dossier.id, self.libelle).notify
end
end
end