mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
ProjectEntityHandler.addFolder take only project id and
only gets project folder structure
This commit is contained in:
parent
2a6e09a41b
commit
7a28eeeaa0
3 changed files with 6 additions and 6 deletions
|
@ -50,7 +50,7 @@ module.exports =
|
|||
copyFolder = (folder, desFolder, callback)->
|
||||
jobs = folder.folders.map (childFolder)->
|
||||
return (callback)->
|
||||
projectEntityHandler.addFolder newProject, desFolder._id, childFolder.name, (err, newFolder)->
|
||||
projectEntityHandler.addFolder newProject._id, desFolder._id, childFolder.name, (err, newFolder)->
|
||||
copyFolder childFolder, newFolder, callback
|
||||
jobs.push (cb)->
|
||||
copyDocs folder, desFolder, cb
|
||||
|
|
|
@ -236,12 +236,12 @@ module.exports = ProjectEntityHandler =
|
|||
!folder.filterOut
|
||||
callback(null, folders, lastFolder)
|
||||
|
||||
addFolder: (project_or_id, parentFolder_id, folderName, callback) ->
|
||||
addFolder: (project_id, parentFolder_id, folderName, callback) ->
|
||||
folder = new Folder name: folderName
|
||||
Project.getProject project_or_id, "", (err, project) ->
|
||||
ProjectGetter.getProjectWithOnlyFolders project_id, (err, project)=>
|
||||
return callback(err) if err?
|
||||
confirmFolder project, parentFolder_id, (parentFolder_id)=>
|
||||
logger.log project: project_or_id, parentFolder_id:parentFolder_id, folderName:folderName, "new folder added"
|
||||
logger.log project: project_id, parentFolder_id:parentFolder_id, folderName:folderName, "new folder added"
|
||||
Project.putElement project._id, parentFolder_id, folder, "folder", (err, result)=>
|
||||
if callback?
|
||||
callback(err, folder, parentFolder_id)
|
||||
|
|
|
@ -124,8 +124,8 @@ describe 'ProjectDuplicator', ->
|
|||
|
||||
it 'should copy all the folders', (done)->
|
||||
@duplicator.duplicate @owner, @project_id, "", (err, newProject)=>
|
||||
@entityHandler.addFolder.calledWith(@stubbedNewProject, @stubbedNewProject.rootFolder[0]._id, @level1folder.name).should.equal true
|
||||
@entityHandler.addFolder.calledWith(@stubbedNewProject, @newFolder._id, @level2folder.name).should.equal true
|
||||
@entityHandler.addFolder.calledWith(@stubbedNewProject._id, @stubbedNewProject.rootFolder[0]._id, @level1folder.name).should.equal true
|
||||
@entityHandler.addFolder.calledWith(@stubbedNewProject._id, @newFolder._id, @level2folder.name).should.equal true
|
||||
@entityHandler.addFolder.callCount.should.equal 2
|
||||
done()
|
||||
|
||||
|
|
Loading…
Reference in a new issue