mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
96cedec946
1 changed files with 12 additions and 10 deletions
|
@ -88,7 +88,9 @@ UserSchema.statics.updateServiceSettings = (doc, callback) ->
|
|||
emailChanged = (not existingProps) or existingProps?.email isnt doc.get('email')
|
||||
|
||||
if emailChanged and customerID = doc.get('stripe')?.customerID
|
||||
stripe.customers.update customerID, {email:doc.get('email')}, (err, customer) ->
|
||||
unless stripe?.customers
|
||||
console.error('Oh my god, Stripe is not imported correctly-how could we have done this (again)?')
|
||||
stripe?.customers?.update customerID, {email:doc.get('email')}, (err, customer) ->
|
||||
console.error('Error updating stripe customer...', err) if err
|
||||
|
||||
return callback?() unless emailChanged or doc.newsSubsChanged
|
||||
|
@ -180,10 +182,10 @@ UserSchema.methods.register = (done) ->
|
|||
@saveActiveUser 'register'
|
||||
|
||||
UserSchema.methods.isPremium = ->
|
||||
return false unless stripe = @get('stripe')
|
||||
return true if stripe.subscriptionID
|
||||
return true if stripe.free is true
|
||||
return true if _.isString(stripe.free) and new Date() < new Date(stripe.free)
|
||||
return false unless stripeObject = @get('stripe')
|
||||
return true if stripeObject.subscriptionID
|
||||
return true if stripeObject.free is true
|
||||
return true if _.isString(stripeObject.free) and new Date() < new Date(stripeObject.free)
|
||||
return false
|
||||
|
||||
UserSchema.statics.saveActiveUser = (id, event, done=null) ->
|
||||
|
|
Loading…
Reference in a new issue