Closed smsoft-ru closed 1 month ago
The app.js source is at https://github.com/the-djmaze/snappymail/tree/master/dev
I know, but app.js there is split to many small files. Sorry, it is too complicated and time consuming for me to understand hierarchy of these files without good documentation or at least comments in source code. So I can provide only patch to installed Snappymail.
I've put your patch with small modifications in a branch: https://github.com/the-djmaze/snappymail/tree/mark-for-deletion-issue-1657
As there is one issue to be resolved:
In SnappyMail you can set a custom Trash folder. On delete, the message is moved to the configured trash folder.
When marking as deleted, this will NOT happen. It is up to the IMAP server what will be done with those messages.
So for now you know where the code is, and why it is not implemented yet.
Thank you for your effort.
Didn't understand problem with custom Trash folder. The code in my patch work only if user set up Trash folder to DO NOT USE value, i.e. the user decided to not use Trash folder at all. If Trash folder exists and set up (unimportant how is it named) - all works as usual, delete button and delete menu both move message to Trash. And yes, it is up to the IMAP server to expunge deleted messages periodically. Or user may periodically use "Delete permanently" if the server doesn't support this feature. In any case it is task for mail administrator to properly set up mail server and instruct users accordingly.
I understand and didn't explain properly.
I was more thinking about an additional menu item "expunge deleted messages"
I don't think this is required. "Delete permanently" does it. As further UI improvement, in case "mark for deletion" is enabled, Delete menu and button may be dynamically renamed to "Mark for deletion". And good icon for Undelete menu option. Maybe overturned trash bin...
As a separate improvement, a timer can be added that schedules an expunge command for all folders in the account (with new option in account settings). I don't know mail client with such feature, it may be unique.
And good icon for Undelete menu option. Maybe overturned trash bin...
I did that with transform: rotate(-180deg);
Merged with some slight changes.
Now it only uses the \Deleted
flag when the trash system folder is set to "Do not use"
Found some visual discordance. See:
The button with overturned trash bin has rounded corners on the left side instead of the right side.
I prepared small patch to fix this. Also it moves rotation to .css file to allow theme designer to override this behavior.
snappymail_icon.patch
As known, in the IMAP protocol, deleting email messages occurs in two stages: firstly, the message is marked for deletion (IMAP delete command), and secondly, marked messages are deleted from storage (IMAP expunge command). Many IMAP servers can be configured to periodically run an expunge command on all folders on the server, eliminating the need for slow expunge commands from clients. Most mail clients support this mode, having an option “mark for deletion instead of deleting”. Snappymail partially support this feature too: it can show deleted messages with striked out caption, and there is option for show/hide deleted messages, but the main part of feature is absent: Snappymail can only move removed messages to trash bin folder or immediately delete + expunge such messages.
Proposed patch adds this feature to Snappymail. snappymail_delete.patch
No new settings added. Feature triggers by the setting of system folder "Trash" to "Do not use" or "Choose one". In this mode Delete button and "Delete" menu options on both menu (on message pane and messages list pane) mark current/selected message(s) for deletion, menu option "Delete permanently" works as usual, and "Undelete" menu option unmarks current/selected marked for deletion messages. On the message pane menu option "Delete" is hidden and "Undelete" is visible if current message is marked for deletion, and vise versa. On the messages list pane Delete button and "Delete" menu option are disabled if there are no selected not marked for deletion messages; "Undelete" menu option is hidden if there are no selected marked for deletion messages.
During developing this patch I found one more minor bug in Snappymail UI: transition from state "no message selected" to "one or more messages selected" clears disabled status from all buttons and menu options on messages list pane. Selecting another message restores disabled status.
Patch works as desired with Snappymail 2.36.4 on Nextcloud 29.0.3.4 on Apache 2.4.59 with PHP 8.2.20 on Debian 6.1.94-1 in browser Microsoft Edge on Windows 11. Other combinations of environment not tested.
P.S. I tried to fork the project and create pull request, but not, didn't master it, source code doesn't contain app.js, so only patch.