mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #20129 from overleaf/jpa-handle-partial-deletion
[misc] improve handling of document deletion GitOrigin-RevId: bd6b225b91ab38365e9ff272c50ece995e767bf2
This commit is contained in:
@@ -774,6 +774,10 @@ const deleteEntity = wrapWithLock(
|
||||
throw new Error('No entityType set')
|
||||
}
|
||||
entityType = entityType.toLowerCase()
|
||||
|
||||
// Flush the entire project to avoid leaving partially deleted docs in redis.
|
||||
await DocumentUpdaterHandler.promises.flushProjectToMongo(projectId)
|
||||
|
||||
const { entity, path, projectBeforeDeletion, newProject } =
|
||||
await ProjectEntityMongoUpdateHandler.promises.deleteEntity(
|
||||
projectId,
|
||||
|
||||
@@ -1731,6 +1731,12 @@ describe('ProjectEntityUpdateHandler', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it('flushes the project to mongo', function () {
|
||||
this.DocumentUpdaterHandler.promises.flushProjectToMongo.should.have.been.calledWith(
|
||||
projectId
|
||||
)
|
||||
})
|
||||
|
||||
it('deletes the entity in mongo', function () {
|
||||
this.ProjectEntityMongoUpdateHandler.promises.deleteEntity
|
||||
.calledWith(projectId, docId, 'doc')
|
||||
|
||||
Reference in New Issue
Block a user