Fewer mails sent to the submitter

This commit is contained in:
echarp 2016-09-11 23:53:09 +02:00
parent 0cc86601d0
commit c27b292879

View File

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