mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[web] allow admins to clone projects with ranges and entire history (#32739)
* [web] add consistent aria-label to editing/reviewing toggle * [docstore] add endpoint for getting all docs with ranges * [history-v1] fix schema of chunkId when deleting old history chunk * [web] skip duplicate project lookup for resolving rootDocPath * [web] ignore new limits for root doc path when making debug copy * [web] allow admins to clone projects with ranges and entire history * [web] fix tests * [history-v1] re-order params for cloning project * [web] fix duplicate import of logger after merge * [project-history] re-order params for cloning project history metadata GitOrigin-RevId: 7fa35b4f90885dd453150a348d491ba0ec8de412
This commit is contained in:
@@ -51,6 +51,10 @@ app.param('doc_id', function (req, res, next, docId) {
|
||||
|
||||
app.get('/project/:project_id/doc-deleted', HttpController.getAllDeletedDocs)
|
||||
app.get('/project/:project_id/doc', HttpController.getAllDocs)
|
||||
app.get(
|
||||
'/project/:project_id/doc-with-ranges',
|
||||
HttpController.getAllDocsWithRanges
|
||||
)
|
||||
app.get('/project/:project_id/doc-versions', HttpController.getAllDocVersions)
|
||||
app.get('/project/:project_id/ranges', HttpController.getAllRanges)
|
||||
app.get(
|
||||
|
||||
@@ -58,6 +58,24 @@ async function getAllDocs(req, res) {
|
||||
res.json(docViews)
|
||||
}
|
||||
|
||||
async function getAllDocsWithRanges(req, res) {
|
||||
const { project_id: projectId } = req.params
|
||||
logger.debug({ projectId }, 'getting all docs with ranges')
|
||||
const docs = await DocManager.getAllNonDeletedDocs(projectId, {
|
||||
lines: true,
|
||||
rev: true,
|
||||
ranges: true,
|
||||
})
|
||||
const docViews = _buildDocsArrayView(projectId, docs)
|
||||
for (const docView of docViews) {
|
||||
if (!docView.lines) {
|
||||
logger.warn({ projectId, docId: docView._id }, 'missing doc lines')
|
||||
docView.lines = []
|
||||
}
|
||||
}
|
||||
res.json(docViews)
|
||||
}
|
||||
|
||||
async function getAllDocVersions(req, res) {
|
||||
const { project_id: projectId } = req.params
|
||||
const docs = await DocManager.getAllDocVersions(projectId)
|
||||
@@ -248,6 +266,7 @@ export default {
|
||||
isDocDeleted: expressify(isDocDeleted),
|
||||
getRawDoc: expressify(getRawDoc),
|
||||
getAllDocs: expressify(getAllDocs),
|
||||
getAllDocsWithRanges: expressify(getAllDocsWithRanges),
|
||||
getAllDeletedDocs: expressify(getAllDeletedDocs),
|
||||
getAllRanges: expressify(getAllRanges),
|
||||
getAllDocVersions: expressify(getAllDocVersions),
|
||||
|
||||
Reference in New Issue
Block a user