Delay MailChimp subscribing after account creation by 30min

This commit is contained in:
Matt Lott 2016-05-31 12:30:36 -07:00
parent ffcd89d327
commit abc42298c6

View file

@ -162,6 +162,9 @@ UserSchema.statics.updateServiceSettings = (doc, callback) ->
return callback?() unless isProduction or GLOBAL.testing
return callback?() if doc.updatedMailChimp
return callback?() unless doc.get('email')
return callback?() unless doc.get('dateCreated')
accountAgeMinutes = (new Date().getTime() - doc.get('dateCreated').getTime?() ? 0) / 1000 / 60
return callback?() unless accountAgeMinutes > 30 or GLOBAL.testing
existingProps = doc.get('mailChimp')
emailChanged = (not existingProps) or existingProps?.email isnt doc.get('email')