Desktop: Fixes #10236: Fix note disappears while editing during search #10568
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.
Summary
This pull request fixes a bug in the updated logic for
NOTE_UPDATE_ONE
introduced in d63615b.Prior to d63615b, a note was considered "in the same folder" if it had the same
parent_id
. With the introduction of a virtual trash folder, a note'sparent_id
property might not be its displayed parent folder.1 When the trash folder is selected, restoring a folder doesn't change itsparent_id
, but does change its displayed parent ID. The UI should show that a restored item is no longer in the trash folder. d63615b handled this by checking whether the note was still displayed inselectedFolderId
. This, however, was problematic when a search or tag, rather than a folder, was selected.Rather than comparing the new display parent ID with
selectedFolderId
, this pull request compares the old display parent ID with the new display parent ID.Fixes #10388.
Fixes #10236.
Testing
This pull request includes an automated regression test. However, for now, it doesn't verify that 1) restoring from trash still works and 2) editing a note after selecting a tag still works. These have been tested manually by:
Footnotes
Previously, this was also the case for conflicts. However, those are handled differently. ↩