Desktop,Mobile,Cli: Render misplaced notebooks#13109
Desktop,Mobile,Cli: Render misplaced notebooks#13109personalizedrefrigerator wants to merge 17 commits intolaurent22:devfrom
Conversation
|
Joplin server has a task which cleans up orphaned notebooks periodically on the server side (according to code comments it is to prevent some potential key violation). I believe they are the same thing as misplaced notes, so it might be worth considering if that server side task can be removed if we're going to make these items visible in the UI now. Also, a couple of questions:
|
If this refers to In particular, it:
Yes.
Thank you for the suggestion — I've added an item to the "Tasks" section of the pull request description. I've marked it as "Optional" for now since this change may make the pull request much more complicated and these notes should also be included in "All notes". |
|
Yes, processOrphanedItems is what I was referring to, and yes it looks like it is related to user data management, rather than orphaned notes / notebooks. It was quite a while ago I came across this, so I guess I misinterpreted it at the time |
…n below the trash)
…ooks into the misplaced folder
|
Just wondering, is there any particular issue that is preventing this coming out of draft, or is it purely because not all testing has been completed? |
It's purely testing related. I'm not aware of any functionality issues. |
|
@personalizedrefrigerator I did some local testing of your code change for the remaining scenarios and it seems to be mostly ok, but does have a couple of issues.
Steps for testing:
So for this test case, it does not cause any issue if notebooks within the misplaced notebook are later deleted without their children being deleted. However, if I then do: In terms of the other test scenarios, you can't rename the misplaced notebook or move to it on mobile, but you can create a note in the misplaced notebook. See video: studio64_nUxJxdsY8Y.mp4 |
|
Thank you for testing!!! I've updated the to-do checklist. |
FYI you'll need to merge in the latest upstream changes for my 'steps for testing', as they rely on #13167 to work correctly |
I suspect you could implement this in the Folder.all() function via a sql query (selecting a count of notes and notebooks with the parent id populated and not matching any notebook), in the same way as is done with Note.conflictedCount() in the same function, instead of determining based on misplacedItems.length. And possibly a new option needs to be added similar to the includeConflictFolder field. joplin/packages/lib/models/Folder.ts Line 359 in 98c5a9c |
|
Currently, (tested on desktop) if you right click and choose restore note for an individual note within a notebook which is in the trash, the note will have no notebook and only show in the all note notebook. I think it is ok retain that behaviour, but this PR will provide a place where it can be seen more easily |
|
@personalizedrefrigerator, I'm closing this PR for now. I suggest we look into it at a later time |
Summary
This pull shows subnotebooks that have a nonexistent parent notebook in the sidebar. Previously, such notebooks were not shown at all.
This change may help users recover from issues similar to #12075 (depending on the cause of #12075).
This pull request is currently a draft, pending refactoring.
Details
It's possible, in some cases, for a notebook to be assigned a parent notebook that does not exist yet or no longer exists (e.g. an incomplete sync, a server bug). Prior to this pull request, such notebooks were not rendered in the notebook tree. With this pull request, these notebooks are rendered in a "Misplaced" notebook.
Screenshot
Tasks
Note.previewswhen the "misplaced" folder is selected.parent_iddirectly in the "Misplaced" folder.Thank you @mrjo118 for helping test this pull request!