Merge pull request #1630 from sharelatex/as-allow-deleted-inviter-import

Allow deleted v1 user when importing project invite inviter

GitOrigin-RevId: be8fc8f09452b72128592f9c00859aaa0b535c3d
This commit is contained in:
Shane Kilkelly 2019-03-22 10:10:45 +00:00 committed by sharelatex
parent 0305ba0c6b
commit a51fefae6c
2 changed files with 9 additions and 1 deletions

View file

@ -215,7 +215,8 @@ module.exports = CollaboratorsHandler =
else
return callback(new Error("unknown privilegeLevel: #{privilegeLevel}"))
ContactManager.addContact adding_user_id, user_id
if adding_user_id
ContactManager.addContact adding_user_id, user_id
Project.update { _id: project_id }, { $addToSet: level }, (error) ->
return callback(error) if error?

View file

@ -322,6 +322,13 @@ describe "CollaboratorsHandler", ->
it "should not add the user again", ->
@Project.update.called.should.equal false
describe "with null adding_user_id", ->
beforeEach ->
@CollaboratorHandler.addUserIdToProject @project_id, null, @user_id, "readAndWrite", @callback
it "should not add the adding user as a contact", ->
@ContactManager.addContact.called.should.equal(false)
describe "removeUserFromAllProjects", ->
beforeEach (done) ->
@CollaboratorHandler.getProjectsUserIsMemberOf = sinon.stub()