mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add overleaf to projections for project structure updates
This commit is contained in:
parent
9ef40902ca
commit
7755a7cc1f
2 changed files with 18 additions and 18 deletions
|
@ -31,7 +31,7 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
LOCK_NAMESPACE: LOCK_NAMESPACE
|
||||
|
||||
addDoc: wrapWithLock (project_id, folder_id, doc, callback = (err, result) ->) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true}, (err, project) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true, overleaf:true}, (err, project) ->
|
||||
if err?
|
||||
logger.err project_id:project_id, err:err, "error getting project for add doc"
|
||||
return callback(err)
|
||||
|
@ -40,7 +40,7 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
self._putElement project, folder_id, doc, "doc", callback
|
||||
|
||||
addFile: wrapWithLock (project_id, folder_id, fileRef, callback = (error, result, project) ->)->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true}, (err, project) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true, overleaf:true}, (err, project) ->
|
||||
if err?
|
||||
logger.err project_id:project_id, err:err, "error getting project for add file"
|
||||
return callback(err)
|
||||
|
@ -49,7 +49,7 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
self._putElement project, folder_id, fileRef, "file", callback
|
||||
|
||||
replaceFileWithNew: wrapWithLock (project_id, file_id, newFileRef, callback) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder: true, name:true}, (err, project) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true, overleaf:true}, (err, project) ->
|
||||
return callback(err) if err?
|
||||
ProjectLocator.findElement {project:project, element_id: file_id, type: 'file'}, (err, fileRef, path)=>
|
||||
return callback(err) if err?
|
||||
|
@ -110,7 +110,7 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
callback null, folders, lastFolder
|
||||
|
||||
moveEntity: wrapWithLock (project_id, entity_id, destFolderId, entityType, callback = (error) ->) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true}, (err, project) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true, overleaf:true}, (err, project) ->
|
||||
return callback(err) if err?
|
||||
ProjectLocator.findElement {project, element_id: entity_id, type: entityType}, (err, entity, entityPath)->
|
||||
return callback(err) if err?
|
||||
|
@ -127,10 +127,10 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
startPath = entityPath.fileSystem
|
||||
endPath = result.path.fileSystem
|
||||
changes = {oldDocs, newDocs, oldFiles, newFiles}
|
||||
callback null, project.name, startPath, endPath, entity.rev, changes, callback
|
||||
callback null, project, startPath, endPath, entity.rev, changes, callback
|
||||
|
||||
deleteEntity: wrapWithLock (project_id, entity_id, entityType, callback) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {name:true, rootFolder:true}, (error, project) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {name:true, rootFolder:true, overleaf:true}, (error, project) ->
|
||||
return callback(error) if error?
|
||||
ProjectLocator.findElement {project: project, element_id: entity_id, type: entityType}, (error, entity, path) ->
|
||||
return callback(error) if error?
|
||||
|
@ -139,7 +139,7 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
callback null, entity, path, project
|
||||
|
||||
renameEntity: wrapWithLock (project_id, entity_id, entityType, newName, callback) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true}, (error, project)=>
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true, overleaf:true}, (error, project)=>
|
||||
return callback(error) if error?
|
||||
ProjectEntityHandler.getAllEntitiesFromProject project, (error, oldDocs, oldFiles) =>
|
||||
return callback(error) if error?
|
||||
|
@ -161,10 +161,10 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
return callback(error) if error?
|
||||
startPath = entPath.fileSystem
|
||||
changes = {oldDocs, newDocs, oldFiles, newFiles}
|
||||
callback null, project.name, startPath, endPath, entity.rev, changes, callback
|
||||
callback null, project, startPath, endPath, entity.rev, changes, callback
|
||||
|
||||
addFolder: wrapWithLock (project_id, parentFolder_id, folderName, callback) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true}, (err, project) ->
|
||||
ProjectGetter.getProjectWithoutLock project_id, {rootFolder:true, name:true, overleaf:true}, (err, project) ->
|
||||
if err?
|
||||
logger.err project_id:project_id, err:err, "error getting project for add folder"
|
||||
return callback(err)
|
||||
|
@ -325,4 +325,4 @@ module.exports = ProjectEntityMongoUpdateHandler = self =
|
|||
deletedAt: new Date()
|
||||
}
|
||||
}
|
||||
}, {}, callback
|
||||
}, {}, callback
|
||||
|
|
|
@ -57,7 +57,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it 'gets the project', ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {rootFolder:true, name: true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it 'checks the folder exists', ->
|
||||
|
@ -80,7 +80,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it 'gets the project', ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {rootFolder:true, name: true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it 'checks the folder exists', ->
|
||||
|
@ -106,7 +106,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it 'gets the project', ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {rootFolder:true, name: true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it 'finds the existing element', ->
|
||||
|
@ -241,7 +241,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it 'should get the project', ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {rootFolder:true, name:true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it 'should find the doc to move', ->
|
||||
|
@ -280,7 +280,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it "should get the project", ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {name:true, rootFolder:true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it "should find the element", ->
|
||||
|
@ -325,7 +325,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it 'should get the project', ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {rootFolder:true, name:true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it 'should find the doc', ->
|
||||
|
@ -363,7 +363,7 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
|
||||
it 'gets the project', ->
|
||||
@ProjectGetter.getProjectWithoutLock
|
||||
.calledWith(project_id, {rootFolder:true, name: true})
|
||||
.calledWith(project_id, {rootFolder:true, name:true, overleaf:true})
|
||||
.should.equal true
|
||||
|
||||
it 'checks the parent folder exists', ->
|
||||
|
@ -638,4 +638,4 @@ describe 'ProjectEntityMongoUpdateHandler', ->
|
|||
.should.equal true
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.called.should.equal true
|
||||
@callback.called.should.equal true
|
||||
|
|
Loading…
Reference in a new issue