From 8ab42450cad35c94f508591ffb14799acd8344a6 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 18 Apr 2016 12:07:00 +0300 Subject: [PATCH 1/2] Story#117612061 - do not send email if it's contact was removed --- app/mailers/contact_mailer.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 08beae05d..731175d5d 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -4,6 +4,11 @@ class ContactMailer < ApplicationMailer def email_updated(old_email, email, contact_id, should_deliver) @contact = Contact.find_by(id: contact_id) @old_email = old_email + unless @contact + Rails.logger.info "Cannot send email in #{self.class.name}.#{__method__} with contact_id #{contact_id}. It cannot be found" + return + end + return unless email || @contact return if delivery_off?(@contact, should_deliver) From 5b32ba5e5875a4c8290b41b204fc004c3d93fb66 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 18 Apr 2016 12:07:13 +0300 Subject: [PATCH 2/2] Story#117612061 - do not send email if it's contact was removed --- app/mailers/contact_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 731175d5d..bbfecfca6 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -5,7 +5,7 @@ class ContactMailer < ApplicationMailer @contact = Contact.find_by(id: contact_id) @old_email = old_email unless @contact - Rails.logger.info "Cannot send email in #{self.class.name}.#{__method__} with contact_id #{contact_id}. It cannot be found" + Rails.logger.info "Cannot send email in #{self.class.name}##{__method__} with contact_id #{contact_id}. It cannot be found" return end