WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@mrjo118
Copy link
Contributor

@mrjo118 mrjo118 commented Nov 30, 2025

While implementing a conditionally created / reused 'Imported Notes' folder in PR #13742 I found that the 'Restored Notes' folder which I based it on would be reused if a folder with that name exists and is trashed. In this scenario it would better to create a new 'Restored Notes' to avoid confusion to the user, and this PR implements this behaviour.

Testing

  1. Take an existing note with 1 or more revisions
  2. Restore a revision
  3. Delete the 'Restored Notes' folder
  4. Restore another revision
  5. Observe a new 'Restored Notes' folder
  6. Restore another revision
  7. Observe the 'Restored Notes' folder which is not in the trash is reused

Comment on lines 1103 to 1105
public static loadByTitleExcludingTrashed(title: string) {
return this.modelSelectOne('SELECT * FROM folders WHERE title = ? AND deleted_time = 0', [title]);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a more generic "loadByField" method with includeDeleted and includeConflicts options - could it be used instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that works. Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants