From 3fd0681a104ddf77d3629d530b6eb42a826f27f9 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 30 May 2018 15:40:35 +0200 Subject: [PATCH 1/3] Enable compression for DB dump download --- lib/tasks/dev.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index b363774b1..1a7b21198 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -71,7 +71,7 @@ namespace :dev do task :import_db do filename = "tps_prod_#{1.day.ago.strftime("%d-%m-%Y")}.sql" local_file = "/tmp/#{filename}" - run_and_stop_if_error "scp deploy@sgmap_backup:/var/backup/production1/db/#{filename} #{local_file}" + run_and_stop_if_error "scp -C deploy@sgmap_backup:/var/backup/production1/db/#{filename} #{local_file}" dev_env_param = "RAILS_ENV=development" From a62adb430751885a2b6c4baaffe29ca6e763acc2 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 30 May 2018 17:07:29 +0200 Subject: [PATCH 2/3] [#1999] Remove dead code --- app/mailers/notification_mailer.rb | 4 ---- spec/controllers/new_user/dossiers_controller_spec.rb | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index b493f8407..9d39aff0f 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -20,10 +20,6 @@ class NotificationMailer < ApplicationMailer send_notification(dossier, dossier.procedure.initiated_mail_template) end - def send_received_notification(dossier) - send_notification(dossier, dossier.procedure.received_mail_template) - end - def send_closed_notification(dossier) send_notification(dossier, dossier.procedure.closed_mail_template) end diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index 0f2b958eb..2717a6883 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -246,7 +246,7 @@ describe NewUser::DossiersController, type: :controller do it { expect(flash.alert).to eq(['nop']) } it 'does not send an email' do - expect(NotificationMailer).not_to receive(:send_received_notification) + expect(NotificationMailer).not_to receive(:send_initiated_notification) subject end From 80e75b33c49f595bc3eb7adcc4d88a740f07f9d4 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 30 May 2018 17:12:06 +0200 Subject: [PATCH 3/3] [Fix #1999] create commentaires for AR --- app/mailers/notification_mailer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 9d39aff0f..7d803b9cf 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -1,8 +1,6 @@ class NotificationMailer < ApplicationMailer default to: Proc.new { @user.email } - after_action :create_commentaire_for_notification, only: [:send_notification, :send_dossier_received] - def send_dossier_received(dossier_id) dossier = Dossier.find(dossier_id) send_notification(dossier, dossier.procedure.received_mail_template) @@ -44,6 +42,8 @@ class NotificationMailer < ApplicationMailer @subject = mail_template.subject_for_dossier dossier @body = mail_template.body_for_dossier dossier + create_commentaire_for_notification + mail(subject: @subject) { |format| format.html { @body } } end