Merge pull request #2002 from betagouv/frederic/fix-1999-store-AR-to-messagerie

Fix #1999 store AR to messagerie
This commit is contained in:
gregoirenovel 2018-05-30 17:22:30 +02:00 committed by GitHub
commit 8f390fa275
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View file

@ -1,8 +1,6 @@
class NotificationMailer < ApplicationMailer class NotificationMailer < ApplicationMailer
default to: Proc.new { @user.email } default to: Proc.new { @user.email }
after_action :create_commentaire_for_notification, only: [:send_notification, :send_dossier_received]
def send_dossier_received(dossier_id) def send_dossier_received(dossier_id)
dossier = Dossier.find(dossier_id) dossier = Dossier.find(dossier_id)
send_notification(dossier, dossier.procedure.received_mail_template) send_notification(dossier, dossier.procedure.received_mail_template)
@ -20,10 +18,6 @@ class NotificationMailer < ApplicationMailer
send_notification(dossier, dossier.procedure.initiated_mail_template) send_notification(dossier, dossier.procedure.initiated_mail_template)
end end
def send_received_notification(dossier)
send_notification(dossier, dossier.procedure.received_mail_template)
end
def send_closed_notification(dossier) def send_closed_notification(dossier)
send_notification(dossier, dossier.procedure.closed_mail_template) send_notification(dossier, dossier.procedure.closed_mail_template)
end end
@ -48,6 +42,8 @@ class NotificationMailer < ApplicationMailer
@subject = mail_template.subject_for_dossier dossier @subject = mail_template.subject_for_dossier dossier
@body = mail_template.body_for_dossier dossier @body = mail_template.body_for_dossier dossier
create_commentaire_for_notification
mail(subject: @subject) { |format| format.html { @body } } mail(subject: @subject) { |format| format.html { @body } }
end end

View file

@ -246,7 +246,7 @@ describe NewUser::DossiersController, type: :controller do
it { expect(flash.alert).to eq(['nop']) } it { expect(flash.alert).to eq(['nop']) }
it 'does not send an email' do it 'does not send an email' do
expect(NotificationMailer).not_to receive(:send_received_notification) expect(NotificationMailer).not_to receive(:send_initiated_notification)
subject subject
end end