From 0bc76b6d92f7bcca736e227f56c085dcff9c9dbf Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 27 Nov 2014 12:07:49 +0000 Subject: [PATCH] mkdir p changed so it does not get entire project, now without doc lines --- .../coffee/Features/Project/ProjectEntityHandler.coffee | 8 ++++---- .../coffee/Project/ProjectEntityHandlerTests.coffee | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee b/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee index 45d169e27b..732c0c88f4 100644 --- a/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee +++ b/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee @@ -195,13 +195,13 @@ module.exports = ProjectEntityHandler = tpdsUpdateSender.addFile {project_id:project._id, file_id:fileRef._id, path:result.path.fileSystem, rev:fileRef.rev, project_name:project.name}, (error) -> callback(error, fileRef, folder_id) - mkdirp: (project_or_id, path, callback = (err, newlyCreatedFolders, lastFolderInPath)->)-> + mkdirp: (project_id, path, callback = (err, newlyCreatedFolders, lastFolderInPath)->)-> self = @ folders = path.split('/') folders = _.select folders, (folder)-> return folder.length != 0 - Project.getProject project_or_id, "", (err, project)=> + ProjectGetter.getProjectWithoutDocLines project_id, (err, project)=> if path == '/' logger.log project_id: project._id, "mkdir is only trying to make path of / so sending back root folder" return callback(null, [], project.rootFolder[0]) @@ -214,10 +214,10 @@ module.exports = ProjectEntityHandler = if parentFolder? parentFolder_id = parentFolder._id builtUpPath = "#{builtUpPath}/#{folderName}" - projectLocator.findElementByPath project_or_id, builtUpPath, (err, foundFolder)=> + projectLocator.findElementByPath project_id, builtUpPath, (err, foundFolder)=> if !foundFolder? logger.log path:path, project_id:project._id, folderName:folderName, "making folder from mkdirp" - @addFolder project_or_id, parentFolder_id, folderName, (err, newFolder, parentFolder_id)-> + @addFolder project_id, parentFolder_id, folderName, (err, newFolder, parentFolder_id)-> newFolder.parentFolder_id = parentFolder_id previousFolders.push newFolder callback null, previousFolders diff --git a/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee b/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee index 29731de247..c25b126e82 100644 --- a/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee @@ -77,6 +77,7 @@ describe 'ProjectEntityHandler', -> @parentFolder_id = "1jnjknjk" @newFolder = {_id:"newFolder_id_here"} @lastFolder = {_id:"123das", folders:[]} + @ProjectGetter.getProjectWithoutDocLines = sinon.stub().callsArgWith(1, null, @project) @projectLocator.findElementByPath = (project_id, path, cb)=> @parentFolder = {_id:"parentFolder_id_here"} lastFolder = path.substring(path.lastIndexOf("/"))