Merge pull request #8644 from overleaf/bg-archive-track-changes

archive track changes zip files in project when history migration fails

GitOrigin-RevId: 67f2381b0a8f2fb1de82100752031c65808af885
This commit is contained in:
Brian Gough
2022-06-30 09:21:50 +01:00
committed by Copybot
parent 93c2168ab2
commit da02a4f2be
4 changed files with 44 additions and 1 deletions
@@ -125,6 +125,27 @@ const ProjectHistoryHandler = {
)
},
setMigrationArchiveFlag(project_id, callback) {
if (callback == null) {
callback = function () {}
}
Project.updateOne(
{ _id: project_id, version: { $exists: true } },
{
'overleaf.history.zipFileArchivedInProject': true,
},
function (err, result) {
if (err != null) {
return callback(err)
}
if ((result != null ? result.n : undefined) === 0) {
return callback(new Error('migration flag not set'))
}
return callback()
}
)
},
ensureHistoryExistsForProject(project_id, callback) {
// We can only set a history id for a project that doesn't have one. The
// history id is cached in the project history service, and changing an