Quick correction to only send an email if a submitter email is present

This commit is contained in:
echarp 2015-12-27 00:35:31 +01:00
parent b4c4e28165
commit 845e0d0983
1 changed files with 8 additions and 6 deletions

View File

@ -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