From 845e0d0983e9bbe73a64b5396b4a0cc9dab03803 Mon Sep 17 00:00:00 2001 From: echarp Date: Sun, 27 Dec 2015 00:35:31 +0100 Subject: [PATCH] Quick correction to only send an email if a submitter email is present --- app/models/orga.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/orga.rb b/app/models/orga.rb index e30bfb8c..9768c80e 100644 --- a/app/models/orga.rb +++ b/app/models/orga.rb @@ -27,17 +27,19 @@ class Orga < ActiveRecord::Base end after_update do - send_secret if secret_changed? && submitter + if submitter + send_secret if secret_changed? - if moderated_changed? - OrgaMailer.accept(self).deliver_now! - else - OrgaMailer.update(self).deliver_now! + if moderated_changed? + OrgaMailer.accept(self).deliver_now! + else + OrgaMailer.update(self).deliver_now! + end end end before_destroy do - OrgaMailer.destroy(self).deliver_now! + OrgaMailer.destroy(self).deliver_now! if submitter end def send_secret