Skip to content

Commit

Permalink
fix: Keep document table entry and only cleanup when we force it
Browse files Browse the repository at this point in the history
We want to keep the document table entry and the presence of a y.js state file in sync

Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Mar 15, 2024
1 parent ec37749 commit 950b633
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,14 @@ public function resetDocument(int $documentId, bool $force = false): void {

$this->stepMapper->deleteBeforeVersion($documentId, $document->getLastSavedVersion());
$this->sessionMapper->deleteByDocumentId($documentId);
$this->documentMapper->delete($document);
$this->getStateFile($documentId)->delete();
$this->logger->debug('reset saved steps and sessions for ' . $documentId);

$this->logger->debug('document reset for ' . $documentId);
if ($force) {
$this->stepMapper->deleteAll($documentId);
$this->documentMapper->delete($document);
$this->getStateFile($documentId)->delete();
$this->logger->debug('reset y.js state, document and all steps for ' . $documentId);
}
} catch (DoesNotExistException|NotFoundException $e) {
// Ignore if document not found or state file not found
}
Expand Down

0 comments on commit 950b633

Please sign in to comment.