mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't choke on null projects
This commit is contained in:
parent
b76cc7e314
commit
882e28a811
2 changed files with 4 additions and 3 deletions
|
@ -95,6 +95,7 @@ module.exports = CollaboratorsHandler =
|
|||
for project in allProjects
|
||||
do (project) ->
|
||||
jobs.push (cb) ->
|
||||
return cb() if !project?
|
||||
CollaboratorsHandler.removeUserFromProject project._id, user_id, cb
|
||||
async.series jobs, callback
|
||||
|
||||
|
|
|
@ -276,13 +276,13 @@ describe "CollaboratorsHandler", ->
|
|||
it "should not add any users to the proejct", ->
|
||||
@CollaboratorHandler.addUserIdToProject.called.should.equal false
|
||||
|
||||
describe "removeUserFromAllProjets", ->
|
||||
describe "removeUserFromAllProjects", ->
|
||||
beforeEach (done) ->
|
||||
@CollaboratorHandler.getProjectsUserIsCollaboratorOf = sinon.stub()
|
||||
@CollaboratorHandler.getProjectsUserIsCollaboratorOf.withArgs(@user_id, { _id: 1 }).yields(
|
||||
null,
|
||||
[ { _id: "read-and-write-0" }, { _id: "read-and-write-1" } ],
|
||||
[ { _id: "read-only-0" }, { _id: "read-only-1" } ]
|
||||
[ { _id: "read-and-write-0" }, { _id: "read-and-write-1" }, null ],
|
||||
[ { _id: "read-only-0" }, { _id: "read-only-1" }, null ]
|
||||
)
|
||||
@CollaboratorHandler.removeUserFromProject = sinon.stub().yields()
|
||||
@CollaboratorHandler.removeUserFromAllProjets @user_id, done
|
||||
|
|
Loading…
Reference in a new issue