Merge pull request #5984 from overleaf/em-unnecessarily-async-functions

Clean up unnecessarily async functions

GitOrigin-RevId: 59f0f0a76b4436f3b99a09b747670d443bac4582
This commit is contained in:
Eric Mc Sween
2021-12-06 10:27:12 -05:00
committed by Copybot
parent d27918bf40
commit b22df1dcba
13 changed files with 268 additions and 404 deletions

View File

@@ -356,23 +356,18 @@ const ProjectController = {
if (err != null) {
return next(err)
}
ProjectEntityHandler.getAllEntitiesFromProject(
project,
(err, docs, files) => {
if (err != null) {
return next(err)
}
const entities = docs
.concat(files)
// Sort by path ascending
.sort((a, b) => (a.path > b.path ? 1 : a.path < b.path ? -1 : 0))
.map(e => ({
path: e.path,
type: e.doc != null ? 'doc' : 'file',
}))
res.json({ project_id: projectId, entities })
}
const { docs, files } = ProjectEntityHandler.getAllEntitiesFromProject(
project
)
const entities = docs
.concat(files)
// Sort by path ascending
.sort((a, b) => (a.path > b.path ? 1 : a.path < b.path ? -1 : 0))
.map(e => ({
path: e.path,
type: e.doc != null ? 'doc' : 'file',
}))
res.json({ project_id: projectId, entities })
})
},