mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-02 11:58:10 -05:00
Fixed a couple bugs and tests.
This commit is contained in:
parent
f7035d4220
commit
b390b38054
2 changed files with 10 additions and 3 deletions
|
@ -47,7 +47,7 @@ UserSchema.methods.setEmailSubscription = (newName, enabled) ->
|
||||||
oldSubs.push(oldName) if enabled
|
oldSubs.push(oldName) if enabled
|
||||||
@set('emailSubscriptions', oldSubs)
|
@set('emailSubscriptions', oldSubs)
|
||||||
|
|
||||||
newSubs = _.clone(@get('emails') or jsonschema.properties.emails.default)
|
newSubs = _.clone(@get('emails') or _.cloneDeep(jsonschema.properties.emails.default))
|
||||||
newSubs[newName] ?= {}
|
newSubs[newName] ?= {}
|
||||||
newSubs[newName].enabled = enabled
|
newSubs[newName].enabled = enabled
|
||||||
@set('emails', newSubs)
|
@set('emails', newSubs)
|
||||||
|
@ -60,7 +60,7 @@ UserSchema.methods.isEmailSubscriptionEnabled = (newName) ->
|
||||||
oldName = emailNameMap[newName]
|
oldName = emailNameMap[newName]
|
||||||
return oldName and oldName in oldSubs if oldSubs
|
return oldName and oldName in oldSubs if oldSubs
|
||||||
emails ?= {}
|
emails ?= {}
|
||||||
_.defaults emails, jsonschema.properties.emails.default
|
_.defaults emails, _.cloneDeep(jsonschema.properties.emails.default)
|
||||||
return emails[newName]?.enabled
|
return emails[newName]?.enabled
|
||||||
|
|
||||||
UserSchema.statics.updateMailChimp = (doc, callback) ->
|
UserSchema.statics.updateMailChimp = (doc, callback) ->
|
||||||
|
|
|
@ -17,7 +17,8 @@ describe '/auth/whoami', ->
|
||||||
describe '/auth/login', ->
|
describe '/auth/login', ->
|
||||||
|
|
||||||
it 'clears Users first', (done) ->
|
it 'clears Users first', (done) ->
|
||||||
User.remove {}, (err) ->
|
clearModels [User], (err) ->
|
||||||
|
throw err if err
|
||||||
request.get getURL('/auth/whoami'), ->
|
request.get getURL('/auth/whoami'), ->
|
||||||
throw err if err
|
throw err if err
|
||||||
done()
|
done()
|
||||||
|
@ -137,6 +138,12 @@ describe '/auth/reset', ->
|
||||||
form.append('password', 'nada')
|
form.append('password', 'nada')
|
||||||
|
|
||||||
describe '/auth/unsubscribe', ->
|
describe '/auth/unsubscribe', ->
|
||||||
|
it 'clears Users first', (done) ->
|
||||||
|
clearModels [User], (err) ->
|
||||||
|
throw err if err
|
||||||
|
request.get getURL('/auth/whoami'), ->
|
||||||
|
throw err if err
|
||||||
|
done()
|
||||||
|
|
||||||
it 'removes just recruitment emails if you include ?recruitNotes=1', (done) ->
|
it 'removes just recruitment emails if you include ?recruitNotes=1', (done) ->
|
||||||
loginJoe (joe) ->
|
loginJoe (joe) ->
|
||||||
|
|
Loading…
Reference in a new issue