Bug: [meta] adjust inconsistencies between deletion warnings for messages and folders
Status: NEW
Priority: --
Created: 2024-05-20 02:36:18+00:00
Resolved: 2024-05-20 15:16:29+00:00

## problem

There are stark and confusing inconsistencies in message and folder handling when it comes to deletion.
In particular there are discrepancies between the cases where TB warns about deleting messages/folders and where it does not.

## example 1

* scenario A: Delete 1 message from inbox. --> no warning
* scenario B: Delete 1 empty folder. --> warning pops up

Comparison:
User receives warning when no messages get deleted (empty folder), but does not receive a warning when an actual message is deleted!
Deleting an empty folder without emails needs confirmation, but deleting an email does not ...

## example 2

* Deleting a message to trash **doesn't** require a confirmation, but permanently deleting a message from trash **does**.
* For folders, the opposite is the case:
   Deleting a folder to trash **does** require a confirmation, but permanently deleting a folder from trash **does not**.

## example 3

* scenario A: Move 2 messages to the trash folder. --> Delete them. --> a warning pops up
* scenario B: Move 1 folder including 2 messages to the trash folder. --> Delete the folder. --> no warning appears

comparison:
* In scenario A, the user loses 2 messages and receives a warning.
* In scenario B, the user loses 2 messages + 1 folder but does NOT receive any warning.

## 💡 suggestions

I would generally suggest to [give users more control](https://bugzilla.mozilla.org/describekeywords.cgi#ux-control) over when they do/don't want to receive warnings. Each case below should have its own user-pref so that users can fine-tune TB's bebaviour according to their needs.

I will try to go through all scenarios and make suggestions:

### 💡 suggestions for folder deletion

* **deletion of any folder (empty or non-empty) which is the target of a move filter**
   * **current behavior**: TB says (see screenshot in [comment #3](https://bugzilla.mozilla.org/show_bug.cgi?id=470666#c3) of bug 470666):
        > Deleting the folder ".............." will disable its associated filter(s).
        > Are you sure you want to delete the folder ?
        > [OK] [cancel]

     But apparently clicking on OK does *not* disable the associated filters as promised, according to [comment #7](https://bugzilla.mozilla.org/show_bug.cgi?id=454589#c7) in bug 454589.

   * **suggested improvement**: see bug 454589: Filters need to get disabled, so that filters don't move messages secretly into the trash.

-----------------------------------------------------------------------------------------------

* **normal deletion of non-empty folder** (outside Trash)
   * **current behavior**: TB says:
      > Are you sure you want to delete the folder "..................." ?
      > [delete folder] [cancel]
   * **suggested improvement**: see bug 1897655
       1. warn user specifically that the folder is not empty, preferably in red letters ([see screenshot](https://bugzilla.mozilla.org/show_bug.cgi?id=1897655#c1))
       2. include the number of messages in the warning

-----------------------------------------------------------------------------------------------

* **SHIFT-deletion of non-empty folder** (outside Trash)
   * **current behavior**: click on a folder in the folder tree --> press `SHIFT`+`DEL` --> no reaction whatsoever! Curiously TB simply ignores this. No warning. Nothing is deleted. TB does nothing.
   * **suggested improvement**: TB should ask:
      > WARNING: This folder is NOT empty. It contains **17** messages. You are about to delete this folder permanently, without saving a copy to Trash. The folder and its messages cannot be recovered. Are you sure you want to continue?
      > [delete] [cancel]

-----------------------------------------------------------------------------------------------

* **normal deletion of empty folder** (outside Trash)
   * **current behavior**: same as for deletion of non-empty folders (see above), which is not helpful! Harmless and harmful situations should not trigger the same warning!
   * **suggested improvement**: see bug 1897662. Let users optionally disable deletion warnings for empty folders.

-----------------------------------------------------------------------------------------------

* **SHIFT-deletion of empty folder** (outside Trash)
   * **current behavior**: same as for SHIFT-del of non-empty folders (see above), i.e. TB does nothing!
   * **suggested improvement**: same as for normal deletion of empty folders (see above), i.e. see bug 1897662, let users optionally disable warning.

-----------------------------------------------------------------------------------------------

* **deletion of non-empty folder inside Trash**
   * **current behavior**: folder is permanently deleted without warning (even when `mail.warn_on_delete_from_trash` = `true` --> inconsistency!!)
   * **suggested improvement**:  add user-pref to enable/disable warning or include in `mail.warn_on_delete_from_trash`

-----------------------------------------------------------------------------------------------

* **deletion of empty folder inside Trash**
   * **current behavior**: empty folder is permanently deleted without warning
   * **suggested improvement**:  None. Current behavior is fine.

-----------------------------------------------------------------------------------------------

### 💡 suggestions for message deletion

* **normal deletion of messages** (outside Trash)
   * **current behavior**: Message is moved to Trash without warning. This is inconsistent with folders (even empty ones) triggering a warning when moved to Trash.
   * **suggested improvement**: add user-pref to enable/disable warning

-----------------------------------------------------------------------------------------------

* **SHIFT-deletion of messages** (outside Trash)
   * **current behavior**: controlled by `mail.warn_on_shift_delete`, default=`true`
   * **suggested improvement**: None. Current behavior is user-selectable, therefore perfect. Default value is ok.

-----------------------------------------------------------------------------------------------

* **deletion of messages inside Trash**
   * **current behavior**: controlled by `mail.warn_on_delete_from_trash`, default=`true`
   * **suggested improvement**: None. Current behavior is user-selectable, therefore perfect. Default value is ok.