mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-31 05:02:43 +00:00
Render a separate template if the invite is not found.
This commit is contained in:
parent
9e0c44573a
commit
78570817d5
4 changed files with 7 additions and 9 deletions
|
@ -50,8 +50,8 @@ module.exports = CollaboratorsInviteController =
|
|||
# TODO: render a not-valid view instead
|
||||
if !invite
|
||||
logger.log {projectId, token}, "no invite found for token"
|
||||
return res.sendStatus(404)
|
||||
res.render "project/invite", {invite}
|
||||
return res.render "project/invite/not-valid"
|
||||
res.render "project/invite/show", {invite}
|
||||
|
||||
acceptInvite: (req, res, next) ->
|
||||
projectId = req.params.Project_id
|
||||
|
|
1
services/web/app/views/project/invite/not-valid.jade
Normal file
1
services/web/app/views/project/invite/not-valid.jade
Normal file
|
@ -0,0 +1 @@
|
|||
h1 Invite Not Valid TEST
|
|
@ -145,7 +145,7 @@ describe "CollaboratorsInviteController", ->
|
|||
|
||||
it 'should render the view template', ->
|
||||
@res.render.callCount.should.equal 1
|
||||
@res.render.calledWith('project/invite').should.equal true
|
||||
@res.render.calledWith('project/invite/show').should.equal true
|
||||
|
||||
it 'should not call next', ->
|
||||
@next.callCount.should.equal 0
|
||||
|
@ -173,12 +173,9 @@ describe "CollaboratorsInviteController", ->
|
|||
@CollaboratorsInviteHandler.getInviteByToken.callsArgWith(2, null, null)
|
||||
@CollaboratorsInviteController.viewInvite @req, @res, @next
|
||||
|
||||
it 'should produce a 404 response', ->
|
||||
@res.sendStatus.callCount.should.equal 1
|
||||
@res.sendStatus.calledWith(404).should.equal true
|
||||
|
||||
it 'should not render the view template', ->
|
||||
@res.render.callCount.should.equal 0
|
||||
it 'should render the not-valid view template', ->
|
||||
@res.render.callCount.should.equal 1
|
||||
@res.render.calledWith('project/invite/not-valid').should.equal true
|
||||
|
||||
it 'should not call next', ->
|
||||
@next.callCount.should.equal 0
|
||||
|
|
Loading…
Reference in a new issue