diff --git a/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee b/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee index bc07ed1f08..ccf8a0870b 100644 --- a/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee +++ b/services/web/app/coffee/Features/Project/ProjectEntityHandler.coffee @@ -14,6 +14,7 @@ slReqIdHelper = require('soa-req-id') docComparitor = require('./DocLinesComparitor') projectUpdateHandler = require('./ProjectUpdateHandler') DocstoreManager = require "../Docstore/DocstoreManager" +ProjectGetter = require "./ProjectGetter" module.exports = ProjectEntityHandler = getAllFolders: (project_id, sl_req_id, callback) -> @@ -24,7 +25,7 @@ module.exports = ProjectEntityHandler = folders[basePath] = folder processFolder path.join(basePath, childFolder.name), childFolder for childFolder in folder.folders - Project.findById project_id, (err, project) -> + ProjectGetter.getProjectWithoutDocLines project_id, (err, project) -> return callback(err) if err? return callback("no project") if !project? processFolder "/", project.rootFolder[0] diff --git a/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee b/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee index cf9230b22f..cd86eb4e8e 100644 --- a/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/Project/ProjectEntityHandlerTests.coffee @@ -64,6 +64,7 @@ describe 'ProjectEntityHandler', -> '../Docstore/DocstoreManager': @DocstoreManager = {} 'logger-sharelatex':{log:->} './ProjectUpdateHandler': @projectUpdater + "./ProjectGetter": @ProjectGetter = {} describe 'mkdirp', -> @@ -507,12 +508,18 @@ describe 'ProjectEntityHandler', -> folders : [] }] ] + @ProjectGetter.getProjectWithoutDocLines = sinon.stub().callsArgWith(1, null, @project) describe "getAllFolders", -> beforeEach -> @callback = sinon.stub() @ProjectEntityHandler.getAllFolders project_id, @callback + it "should get the project without the docs lines", -> + @ProjectGetter.getProjectWithoutDocLines + .calledWith(project_id) + .should.equal true + it "should call the callback with the folders", -> @callback .calledWith(null, {