add token to body of acceptInvite action.

This commit is contained in:
Shane Kilkelly 2016-07-22 09:27:00 +01:00
parent 546517db90
commit 1139444790
2 changed files with 6 additions and 3 deletions

View file

@ -55,9 +55,10 @@ module.exports = CollaboratorsInviteController =
acceptInvite: (req, res, next) ->
projectId = req.params.Project_id
inviteId = req.params.inviteId
{token} = req.body
currentUser = req.session.user
logger.log {projectId, inviteId}, "accepting invite"
CollaboratorsInviteHandler.acceptInvite projectId, inviteId, currentUser, (err) ->
CollaboratorsInviteHandler.acceptInvite projectId, inviteId, token, currentUser, (err) ->
if err?
logger.err {projectId, inviteId}, "error getting invite by token"
return next(err)

View file

@ -239,9 +239,11 @@ describe "CollaboratorsInviteController", ->
invite_id: @invite_id = "thuseoautoh"
@req.session =
user: _id: @current_user_id = "current-user-id"
@req.body =
token: "thsueothaueotauahsuet"
@res.render = sinon.stub()
@res.sendStatus = sinon.stub()
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(3, null)
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(4, null)
@callback = sinon.stub()
@next = sinon.stub()
@ -261,7 +263,7 @@ describe "CollaboratorsInviteController", ->
beforeEach ->
@err = new Error('woops')
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(3, @err)
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(4, @err)
@CollaboratorsInviteController.acceptInvite @req, @res, @next
it 'should not produce a 201 response', ->