All: Fixes #11902: Ensure notebook conflicts do not delete child notes and notebooks when resolved#13167
Merged
laurent22 merged 10 commits intolaurent22:devfrom Oct 9, 2025
Conversation
Collaborator
|
CI should be fixed by #13168. |
laurent22
reviewed
Sep 13, 2025
| changeSource: ItemChange.SOURCE_SYNC, | ||
| sourceDescription: 'sync: handleConflictAction: non-note conflict', | ||
| trackDeleted: false, | ||
| deleteChildren: false, |
Owner
There was a problem hiding this comment.
I think that may be unexpected next time someone looks at this code. Could you please add a short comment above it?
Owner
|
By the way should a test be added for this in |
…cts-do-not-delete-children
Contributor
Author
There is an existing test for the scenario. I've updated it to verify that children are not deleted |
Owner
|
Looks good now, thank you @mrjo118! |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a change to protect against unexpected data loss for a scenario when a notebook conflicts and the remote object no longer exists. Although the cause of the situation is unknown, the situation can be reproduced easily by the following steps:
The existing behaviour happens because when this scenario occurs, Joplin will delete the notebook and all its notes and sub-notebooks without any warning. Although rare and the root cause unknown, this can cause massive data loss if it happens with a top level notebook, so ought to be protected against.
This PR makes a simple change whereby when this scenario occurs, it will only delete the conflicting notebook and not any of the child notes or notebooks. This results in no notes being lost, as they will all still be available in the All Notes notebook, however the notebook hierarchy will be lost. The loss of the notebook hierarchy however will be addressed by PR #13109, but even without this change, it is still possible on Joplin desktop to filter by all notes within a 'misplaced' notebook by clicking the notebook name beneath the note title when one of these notes is opened via All Notes. With this change then, aside from potential difficulties with restoring the notebook hierarchy, the only data which is technically lost is the name of the notebook which was deleted, but even that could be obtained from the log file.
This would be a sufficient fix for #11902
Testing
See video:
electron_fZ7YH2emRQ.mp4