Trashcan

I wonder if we could simply show a raw list of revisions for deleted notes. I've tried before to do a trash can based on the revisions - I thought that would be simple, but after making changes to dozens of files I realised how wrong I was.

So a simple screen that just shows a list of deleted note might be a good option, at least better than nothing.

3 Likes

I understand Laurent, the truth is that if you have tried and the solution you propose is difficult, it is true to do that compared to having nothing.

I am very surprised by all the work you do for Joplin, what is the way to donate for this project?
(Excuse the offtopic)

2 Likes

There is a "Support Us" section on the website.

1 Like

I'm planning to implement a Trashcan plugin, but I haven't gotten around to it yet.

7 Likes

It would be great, from here I encourage you when you have free time! =)

1 Like

Yeah, for some reason one of my very important notes was deleted. Is there any way I can revive it?

It can possibly be restored from the note revisions:

https://discourse.joplinapp.org/t/restoring-deleted-notes/21304/3

Wouldn't it be possible to leave the revisions be and instead soft delete notes?

  • Add a deleted_time column to the notes table
  • SELECT queries would need an additional WHERE deleted_time IS NULL statement
  • DELETE queries would need to be transformed into UPDATE queries, that set the deleted_time column to the current time
  • Trash shows notes which result from query of all notes with WHERE deleted_time IS NOT NULL
  • Current 'DELETE' query is used for deleting notes permanently from trash
  • Restore soft deleted notes would simply UPDATE the note and set deleted_time to NULL

I see several advantages to this approach:

  • note hierarchy is preserved as all note information including the parent_id column is not touched at all (would change by moving note to another folder)
  • timestamps are not modified
  • if note is deleted on one device and modified on another, the changes are simply synced as before (sync select query must include deleted notes). In result, we have one deleted, modified note on both devices (and corresponding revisions for the keep period).
  • App language change does not matter
  • A service to delete files that have been deleted for more than x days as proposed by @laurent would simply do the current permanent DELETE query for all notes WHERE deleted_time > strftime('%s', 'now', '-30 days')
  • deleted notes are excluded from search by default as @mzguy proposed. This could be optional by omitting the WHERE deleted_time IS NULL clause

First I thought this would break some plugins but actually it does not. Plugins that do not apply the now needed WHERE clause simply include soft deleted notes as well. An example is the Note overview plugin that would still work as intended and could easily be enhanced by an option to include/exclude deleted notes (similar to -tag:search it could say +deleted) after an update.

Regarding the frontend: I would probably prefer a simple list of deleted notes with restore and delete permanently buttons over an actual folder as this is the standard for most of the software I use. That way, soft deleted notes are not editable anymore and the trash is not misused as another folder. Additionally we would not need to change the normal context menu of folders or add exceptions for a "trash folder" but introduce a new UI.

Maybe this would be programmatically similar to the All notes section on top of the sidebar

2 Likes

Unfortunately, how to do it is not the issue, and that kind of suggestion and many others came up before. Actually implementing this is much more difficult.

Could you elaborate why this is difficult? I understand that a lot of queries would have to be changed and some new trash GUI Elements would have to be created on all platforms which would be quite some work but it would be possible, wouldn't it?

Many other users had similar simple ideas to create the trash feature, and they all found out it wasn't so easy. Maybe your idea is easy, so feel free to give it a try.

Edit: by the way, you can find more technical discussions maybe here or on GitHub about this. We discussed what you're proposing before, as well as several other approaches.

1 Like

I can find many posts about this subject, here and on github, and I'm truly wondering why is so complex. I didn't check the code, and all the posts, so bear with me...

Rather than create a "delete function", we want a moving option. With Thunderbird, the email client, in the account / server settings, there is an option for:

When I delete a message:
a. move it to this folder: "folders selection widget"
b. mark it as deleted
c. delete it immediately

So like Laurent says: "My current plan is to have a regular folder called “trash” where notes are moved when deleted. There will be nothing special about this folder so there won’t be a need for special support for it."

This is it, but you let the user decide which notebook to choose, and you don't have to think about all the what if...

So, maybe joplin could keep the default option as to "delete immediately", as it is now, and in the options menu, we could have an option to select a notebook as a target for deleted objects.

Next, we have to popup an error message when the user delete something, and the selected notebook doesn't exist anymore. (at this point nothing happen, nothing deleted)

And finally(?) how to "permanently delete" the content of the selected notebook?
Maybe from the option menu, not too far from the "notebook selection widget"

  • a button "delete content" of this notebook now? and/or
  • an option to delete content of this notebook after x days? and/or
  • an option to delete content of this notebook on exit?
  • ?

at first it's look weird to have the "permanently delete" action in the options, but that will probably help to keep the main GUI as it is now. (no new delete / purge / empty / ... action in the main menu, and no new entry to add to the faq to explain the difference between a delete and ...)

at this point, we could probably add some options, for the "selected notebook", to display (or not) search results from this notebook.

food for thought

A trash is a standard feature in note app. Not having a recycle bin is indeed quite inconvenient.

Cat just jumped on the keyboard. Before I could do anything, the note was gone. A trash can would be handy.

5 Likes

Apparently, this has been developed and will be added in v3.0:

v3.0 is set to be released beginning of July:

Thanks a lot for your great work, Laurent!

2 Likes

This is a very minor thing but would it be difficult to allow renaming the "Trash" notebook to a custom name by the user? For the record, even Windows allows to rename the "Recycle Bin" to anything you want (without changes to the actual functionality, of course).

Also, no offence please, but the huge bin icon is kind of ugly, but at least that can be easily removed with custom CSS. I think it might fit better if it followed the same style as the "Tags" icon, i.e. only outlines coloured and empty inside:

image

I'm also curious whether it could be possible to show the number of trashed notes next to the name as is the case with regular notebooks.

I agree with this - would be a very useful part of its functionality and consistent too.