mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 19:50:47 +00:00
send fixed confirmed date to v1 for affiliations
This commit is contained in:
parent
55597b9279
commit
96ffeef73d
4 changed files with 6 additions and 6 deletions
|
@ -25,11 +25,11 @@ module.exports = InstitutionsAPI =
|
|||
callback = affiliationOptions
|
||||
affiliationOptions = {}
|
||||
|
||||
{ university, department, role, confirmed } = affiliationOptions
|
||||
{ university, department, role, confirmedAt } = affiliationOptions
|
||||
makeAffiliationRequest {
|
||||
method: 'POST'
|
||||
path: "/api/v2/users/#{userId.toString()}/affiliations"
|
||||
body: { email, university, department, role, confirmed }
|
||||
body: { email, university, department, role, confirmedAt }
|
||||
defaultErrorMessage: "Couldn't create affiliation"
|
||||
}, callback
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ module.exports = UserUpdater =
|
|||
email = EmailHelper.parseEmail(email)
|
||||
return callback(new Error('invalid email')) if !email?
|
||||
logger.log {userId, email}, 'confirming user email'
|
||||
addAffiliation userId, email, { confirmed: true }, (error) =>
|
||||
addAffiliation userId, email, {confirmedAt: confirmedAt}, (error) =>
|
||||
if error?
|
||||
logger.err error: error, 'problem adding affiliation while confirming email'
|
||||
return callback(error)
|
||||
|
|
|
@ -74,7 +74,7 @@ describe "InstitutionsAPI", ->
|
|||
university: { id: 1 }
|
||||
role: 'Prof'
|
||||
department: 'Math'
|
||||
confirmed: true
|
||||
confirmedAt: new Date()
|
||||
@InstitutionsAPI.addAffiliation @stubbedUser._id, @newEmail, affiliationOptions, (err)=>
|
||||
should.not.exist(err)
|
||||
@request.calledOnce.should.equal true
|
||||
|
@ -89,7 +89,7 @@ describe "InstitutionsAPI", ->
|
|||
body.university.should.equal affiliationOptions.university
|
||||
body.department.should.equal affiliationOptions.department
|
||||
body.role.should.equal affiliationOptions.role
|
||||
body.confirmed.should.equal affiliationOptions.confirmed
|
||||
body.confirmedAt.should.equal affiliationOptions.confirmedAt
|
||||
done()
|
||||
|
||||
it 'handle error', (done)->
|
||||
|
|
|
@ -241,7 +241,7 @@ describe "UserUpdater", ->
|
|||
@UserUpdater.confirmEmail @stubbedUser._id, @newEmail, (err)=>
|
||||
should.not.exist(err)
|
||||
@addAffiliation.calledOnce.should.equal true
|
||||
sinon.assert.calledWith(@addAffiliation, @stubbedUser._id, @newEmail, { confirmed: true } )
|
||||
sinon.assert.calledWith(@addAffiliation, @stubbedUser._id, @newEmail, { confirmedAt: new Date() } )
|
||||
done()
|
||||
|
||||
it 'handle error', (done)->
|
||||
|
|
Loading…
Add table
Reference in a new issue