Merge pull request #14235 from overleaf/ii-history-project-diff

Project history diff fix

GitOrigin-RevId: 42d55425873aa610560a03609c01e55606894940
This commit is contained in:
ilkin-overleaf
2023-08-17 08:02:54 +00:00
committed by Copybot
parent 975ea16317
commit 6db48cdaa3
2 changed files with 19 additions and 23 deletions
@@ -71,25 +71,11 @@ function _getInitialFiles(chunk, fromVersion) {
}
function _applyAddFileToDiff(diff, operation) {
const change = diff[operation.pathname]
if (change != null) {
// already exists, likely a delete so just cancel that and put the file back to unchanged
if (change.operation !== 'removed') {
const err = new Errors.InconsistentChunkError(
'trying to add file that already exists',
{ diff, operation }
)
throw err
}
delete diff[operation.pathname].operation
return delete diff[operation.pathname].deletedAtV
} else {
return (diff[operation.pathname] = {
pathname: operation.pathname,
operation: 'added',
editable: operation.file.isEditable(),
})
}
return (diff[operation.pathname] = {
pathname: operation.pathname,
operation: 'added',
editable: operation.file.isEditable(),
})
}
function _applyEditFileToDiff(diff, operation) {