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,15 +7,17 @@ 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)
if event.event.nil?
EventMailer.create(event).deliver_now! EventMailer.create(event).deliver_now!
ModerationMailer.create(event).deliver_now! ModerationMailer.create(event).deliver_now!
end end
end
def self.before_update(event) def self.before_update(event)
if event.moderated_changed? && event.moderated? if event.moderated_changed? && event.moderated?