diff --git a/services/web/app/coffee/Features/Editor/EditorController.coffee b/services/web/app/coffee/Features/Editor/EditorController.coffee index 678d34630e..c52e712e2f 100644 --- a/services/web/app/coffee/Features/Editor/EditorController.coffee +++ b/services/web/app/coffee/Features/Editor/EditorController.coffee @@ -184,9 +184,9 @@ module.exports = EditorController = replaceFile: (project_id, file_id, fsPath, source, callback = (error) ->)-> ProjectEntityHandler.replaceFile project_id, file_id, fsPath, callback - addFolder: (project_id, folder_id, folderName, callback = (error, folder)->)-> + addFolder: (project_id, folder_id, folderName, source, callback = (error, folder)->)-> folderName = folderName.trim() - logger.log {project_id, folder_id, folderName}, "sending new folder to project" + logger.log {project_id, folder_id, folderName, source}, "sending new folder to project" Metrics.inc "editor.add-folder" ProjectEntityHandler.addFolder project_id, folder_id, folderName, (err, folder, folder_id)=> @p.notifyProjectUsersOfNewFolder project_id, folder_id, folder, (error) -> diff --git a/services/web/app/coffee/Features/Editor/EditorHttpController.coffee b/services/web/app/coffee/Features/Editor/EditorHttpController.coffee index 382cf1be24..86acfb79fe 100644 --- a/services/web/app/coffee/Features/Editor/EditorHttpController.coffee +++ b/services/web/app/coffee/Features/Editor/EditorHttpController.coffee @@ -33,7 +33,7 @@ module.exports = EditorHttpController = project_id = req.params.Project_id name = req.body.name parent_folder_id = req.body.parent_folder_id - EditorController.addFolder project_id, parent_folder_id, name, (error, doc) -> + EditorController.addFolder project_id, parent_folder_id, name, "editor", (error, doc) -> return next(error) if error? res.json doc diff --git a/services/web/test/UnitTests/coffee/Editor/EditorControllerTests.coffee b/services/web/test/UnitTests/coffee/Editor/EditorControllerTests.coffee index 8ecf946901..9d15369aa7 100644 --- a/services/web/test/UnitTests/coffee/Editor/EditorControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Editor/EditorControllerTests.coffee @@ -526,7 +526,7 @@ describe "EditorController", -> it 'should add the folder using the project entity handler', (done)-> mock = sinon.mock(@ProjectEntityHandler).expects("addFolder").withArgs(@project_id, @folder_id, @folderName).callsArg(3) - @EditorController.addFolder @project_id, @folder_id, @folderName, -> + @EditorController.addFolder @project_id, @folder_id, @folderName, @source, -> mock.verify() done() @@ -534,7 +534,7 @@ describe "EditorController", -> @ProjectEntityHandler.addFolder = (project_id, folder_id, folderName, callback)=> callback(null, @folder, @folder_id) mock = sinon.mock(@EditorController.p).expects('notifyProjectUsersOfNewFolder').withArgs(@project_id, @folder_id, @folder).callsArg(3) - @EditorController.addFolder @project_id, @folder_id, @folderName, -> + @EditorController.addFolder @project_id, @folder_id, @folderName, @source, -> mock.verify() done() @@ -547,7 +547,7 @@ describe "EditorController", -> it 'should return the folder in the callback', (done) -> @ProjectEntityHandler.addFolder = (project_id, folder_id, folderName, callback)=> callback(null, @folder, @folder_id) - @EditorController.addFolder @project_id, @folder_id, @folderName, (error, folder) => + @EditorController.addFolder @project_id, @folder_id, @folderName, @source, (error, folder) => folder.should.equal @folder done() diff --git a/services/web/test/UnitTests/coffee/Editor/EditorHttpControllerTests.coffee b/services/web/test/UnitTests/coffee/Editor/EditorHttpControllerTests.coffee index a2081a9464..dda8a5fed8 100644 --- a/services/web/test/UnitTests/coffee/Editor/EditorHttpControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Editor/EditorHttpControllerTests.coffee @@ -76,12 +76,12 @@ describe "EditorHttpController", -> @req.body = name: @name = "folder-name" parent_folder_id: @parent_folder_id - @EditorController.addFolder = sinon.stub().callsArgWith(3, null, @folder) + @EditorController.addFolder = sinon.stub().callsArgWith(4, null, @folder) @EditorHttpController.addFolder @req, @res it "should call EditorController.addFolder", -> @EditorController.addFolder - .calledWith(@project_id, @parent_folder_id, @name) + .calledWith(@project_id, @parent_folder_id, @name, "editor") .should.equal true it "should send the folder back as JSON", ->