Fewer mails sent to the submitter

This commit is contained in:
echarp 2016-09-11 23:53:09 +02:00
parent 0cc86601d0
commit c27b292879
1 changed files with 7 additions and 5 deletions

View File

@ -7,14 +7,16 @@ class EventCallbacks
end
def self.before_create(event)
event.secret = SecureRandom.urlsafe_base64(32)[0...32]
event.moderator_mail_id = SecureRandom.urlsafe_base64(32)[0...32]
event.submitter_mail_id = SecureRandom.urlsafe_base64(32)[0...32]
event.secret ||= SecureRandom.urlsafe_base64(32)[0...32]
event.moderator_mail_id ||= SecureRandom.urlsafe_base64(32)[0...32]
event.submitter_mail_id ||= SecureRandom.urlsafe_base64(32)[0...32]
end
def self.after_create(event)
EventMailer.create(event).deliver_now!
ModerationMailer.create(event).deliver_now!
if event.event.nil?
EventMailer.create(event).deliver_now!
ModerationMailer.create(event).deliver_now!
end
end
def self.before_update(event)