Sfoglia il codice sorgente

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

Allow deleted v1 user when importing project invite inviter

GitOrigin-RevId: be8fc8f09452b72128592f9c00859aaa0b535c3d
Shane Kilkelly 7 anni fa
parent
commit
a51fefae6c

+ 2 - 1
services/web/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee

@@ -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?

+ 7 - 0
services/web/test/unit/coffee/Collaborators/CollaboratorsHandlerTests.coffee

@@ -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()