Repository navigation
GH-105: add folder create, move and delete - #106
Merged
Merged
Conversation
Create, move and delete mailboxes from the folder pane and the folders overlay, on N, M and D. The in-process test server creates no missing parents on CREATE, renames no inferior names on RENAME, and deletes a non-empty mailbox without complaint, so chute does that work itself: it creates every missing level, repairs any descendant a rename left behind, and refuses to delete a folder that holds mail or has folders below it. Every operation returns the listing the server reported, so the tree never shows a locally invented name. Move and delete refuse INBOX and any mailbox an [accounts.imap] override names; a folder the server marks with an attribute stays editable, because the attribute travels through a rename. The folders pane also gets its own footer: it was advertising d, f and m, which do nothing in that pane.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds folder management to the folder pane: create (nested), move (nested, after a
confirmation that names the destination), and delete (empty only, after a
confirmation).
N/M/Dare new and unbound before this change; they mirrorm/d— same letter, different pane.Both the folder pane and the folders overlay own the keys, because the two-column
layout draws no folder pane and the overlay is the only folder access there.
Why chute does the parent and cascade work itself
The in-process IMAP server this package tests against does not create missing
parents for
CREATE, does not rename inferior names onRENAME, and does notrefuse
DELETEon a mailbox that still holds mail. RFC 3501 asks a server to do thefirst two, so real servers differ. Assuming either would have shipped a nested create
that shows up as an orphan root, and a move that leaves its subtree behind.
CREATEper missing level, shallowest first; levels already in thelisting are skipped.
RENAME, thenLIST, then repair any descendant still under the oldname (shallowest first). A server that already cascaded leaves nothing to repair, so
the loop is a no-op there.
STATUS, checked under the session mutex,so another client delivering mail between the interface's check and the delete is
still refused.
\Noselectcontainers skip theSTATUS, which some servers refuse.Every operation returns the listing the server reported. The UI draws that listing, never
a locally edited tree.
What changed
mail/folderops.goNewFolder,MoveFolder,DeleteFolder,FolderMessages,FolderConflict,FolderPath,IsBelowmail/client.goCreateMailbox,RenameMailbox,DeleteMailbox,MailboxMessagesmail/errors.gotui/folderops.gotui/foldernew.gotui/foldermove.gotui/folderdelete.goconfig/keys.go,tui/keys.gonew_folder,move_folder,delete_foldertui/{model,confirm,footer,help,client}.goREADME.mdRefusals
INBOX cannot be moved or deleted[accounts.imap]names"Trash" is set as trash in [accounts.imap]; change that setting firstWork has 12 messages; empty it firstWork has 3 folders below it; delete those firsta folder cannot move inside itselfthat folder already existsalready thereA folder the server marks with
\Sent/\Trash/ etc. stays movable and deletable:the attribute travels with the mailbox through a rename, so the role still resolves.
Only a literal config name breaks, and only that is refused.
Test changes outside the feature
Two behaviours changed deliberately, and the tests that encoded the old ones were
updated rather than worked around:
D:delete M:move N:new enter:open q:quit). It was advertisingd:delete f:flag m:move, which do nothing in thatpane. Six footer tests had been exercising the folder pane while claiming to test
the message list; they now say which pane they mean.
Mis bound again, tomove_folder, not toactionMove.TestMoveAndReadBindings MatchTheIssuerecords both facts so bug fixes #88's alias cannot return as a side effect.Verification
The new tests drive the real client against
imapmemserverfor the create/move/deletepaths, and the fake session client for the branch a cascading server takes (nothing to
repair) and the repair order. The TUI tests drive the whole flow through
Update, andTestFolderDialogsFitTheMinimumFrameholds all three dialogs inside the 60x20 floor —it caught the picker title running to 93 cells before this PR was opened.
Closes #105