mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #5860 from overleaf/bg-fix-docupdater-delete-doc
fix docupdater delete operation GitOrigin-RevId: daab03b7659688d53c54ac80756394796d3c6348
This commit is contained in:
@@ -238,17 +238,48 @@ function updateProjectWithLocks(
|
||||
)
|
||||
break
|
||||
case 'rename-doc':
|
||||
DocumentManager.renameDocWithLock(
|
||||
projectId,
|
||||
update.id,
|
||||
userId,
|
||||
update,
|
||||
projectHistoryId,
|
||||
(error, count) => {
|
||||
projectOpsLength = count
|
||||
cb(error)
|
||||
}
|
||||
)
|
||||
if (!update.newPathname) {
|
||||
// an empty newPathname signifies a delete, so there is no need to
|
||||
// update the pathname in redis
|
||||
ProjectHistoryRedisManager.queueRenameEntity(
|
||||
projectId,
|
||||
projectHistoryId,
|
||||
'doc',
|
||||
update.id,
|
||||
userId,
|
||||
update,
|
||||
(error, count) => {
|
||||
projectOpsLength = count
|
||||
cb(error)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
// rename the doc in redis before queuing the update
|
||||
DocumentManager.renameDocWithLock(
|
||||
projectId,
|
||||
update.id,
|
||||
userId,
|
||||
update,
|
||||
projectHistoryId,
|
||||
error => {
|
||||
if (error) {
|
||||
return cb(error)
|
||||
}
|
||||
ProjectHistoryRedisManager.queueRenameEntity(
|
||||
projectId,
|
||||
projectHistoryId,
|
||||
'doc',
|
||||
update.id,
|
||||
userId,
|
||||
update,
|
||||
(error, count) => {
|
||||
projectOpsLength = count
|
||||
cb(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
break
|
||||
case 'add-file':
|
||||
ProjectHistoryRedisManager.queueAddEntity(
|
||||
|
||||
@@ -593,36 +593,14 @@ module.exports = RedisManager = {
|
||||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
|
||||
if (lines != null && version != null) {
|
||||
return rclient.set(
|
||||
keys.pathname({ doc_id }),
|
||||
update.newPathname,
|
||||
function (error) {
|
||||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
return ProjectHistoryRedisManager.queueRenameEntity(
|
||||
project_id,
|
||||
projectHistoryId,
|
||||
'doc',
|
||||
doc_id,
|
||||
user_id,
|
||||
update,
|
||||
callback
|
||||
)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
return ProjectHistoryRedisManager.queueRenameEntity(
|
||||
project_id,
|
||||
projectHistoryId,
|
||||
'doc',
|
||||
doc_id,
|
||||
user_id,
|
||||
update,
|
||||
callback
|
||||
)
|
||||
} else {
|
||||
return callback()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user