Reorder folders by dragging, with special folders first (#402) (#405)

The folder tree ignored sortOrder: Inbox came first, then everything
A–Z, so Sent ended up among ordinary folders. The tree now lists Inbox,
then any order the user has chosen, then the other special folders
(Drafts, Sent, Archive, Junk, Trash), then the rest A–Z. Stalwart gives
every folder sortOrder 0 until someone orders it, so an existing
sidebar changes once, to that default.

Dropping a folder on the top or bottom quarter of a row puts it above or
below that row, with a line to show where it will land. Dropping on the
middle still nests it. Special folders can now be dragged, to be
reordered but never nested; on those, the whole row reorders by the
nearer half. The folder menu gains Move up and Move down, for the
keyboard and touch. Inbox stays first.

A reorder numbers the level 10 apart and writes only the folders whose
number changes, in one Mailbox/set. The order is saved on the server,
so it follows the account to every device and to other JMAP clients.

No new strings: Move up and Move down were already translated.

Fixes #402
This commit is contained in:
jcoffey
2026-09-19 14:06:21 -07:00
committed by GitHub
parent 05df758d0a
commit bc366ac047
8 changed files with 439 additions and 26 deletions
+10 -3
View File
@@ -239,9 +239,16 @@ for that one, and the dialog says so.
Real JMAP mailboxes, with the server's roles honored.
- Create, rename, create a subfolder, delete (with or without its mail).
- **Drag a folder onto another** to reparent it. Folders with a server role
(Inbox, Sent, Drafts, Trash, Junk, Archive) are structural and are not
offered the drag, because the server refuses to move them anyway.
- **Order:** Inbox first, then the other special folders (Drafts, Sent,
Archive, Junk, Trash), then everything else AZ, at every level.
- **Drag a folder between two others** to put it there. The line shows where
it will land. The order is saved on the server as the folders' JMAP
`sortOrder`, so it follows you to every device, and other clients that
honor `sortOrder` show it too. *Move up* and *Move down* in the folder menu
do the same from the keyboard or on touch. Inbox always stays first.
- **Drag a folder onto the middle of another** to reparent it. Folders with a
server role (Sent, Drafts, Trash, Junk, Archive) can be reordered but not
nested, because the server refuses to move them to another parent.
- **Subscribe / unsubscribe** — *Show in list* / *Hide from list*. An
unsubscribed folder still exists and still receives; it is just out of the
way. Inbox cannot be hidden.