mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Get project without doc lines in getAllFolders
This commit is contained in:
parent
6a2370b5be
commit
2fb8b0e807
2 changed files with 9 additions and 1 deletions
|
@ -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]
|
||||
|
|
|
@ -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, {
|
||||
|
|
Loading…
Reference in a new issue