TUI: trash every selected thread with t - #416
Conversation
Space selects threads, but only Ctrl+B acted on the selection; t and every other filing key took the row under the cursor. Trashing a handful of threads meant a keypress per row. With a selection, t now trashes every selected thread in one request, the way the web app's toolbar acts on a selection. The done message carries every posting the action took, so the list, the Previously Seen screen and the overlaid search and bundle lists drop each row as they already do for one. Removing a row also takes it out of the selection, so a failed request leaves the selection standing for another try and a successful one clears it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZgWZQHxm7KdZNLNjxCtQG
There was a problem hiding this comment.
🟢 Approval recommended
The behavior is coherent and tested; the only finding is a non-blocking comment typo.
Pull request overview
Adds bulk trash support for selected TUI threads while preserving single-row behavior.
Changes:
- Sends selected posting IDs in one trash request.
- Removes successful results from lists and selections.
- Adds success/failure tests and updates TUI documentation.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
File summaries
| File | Description |
|---|---|
internal/tui/mail.go |
Implements bulk trash and multi-posting completion handling. |
internal/tui/mail_test.go |
Tests successful and failed bulk trash operations. |
internal/tui/content.go |
Prunes removed rows from selections. |
docs/tui.md |
Documents selection-aware trash behavior. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| boxID int64 | ||
| sourceKind mail.Kind | ||
| postingID int64 | ||
| postingIDs []int64 // every posting a bulk action took, empty for a single row's |
There was a problem hiding this comment.
Leaving this as is. It is the same elliptical form as the filingSeq comment two lines below (zero for a list row's), which is what the new field is modelled on: both elide the struct's own noun — a single row's action. Completing one and not the other would leave the pair reading differently for no gain.
What
Space already selects threads in the TUI, but only Ctrl+B (bulk reply) acted on the selection.
tand the other filing keys took the row under the cursor, so trashing a handful of threads meant one keypress per row.With a selection,
tnow trashes every selected thread in a singlePOST /postings/trash(the SDK'sMoveToTrashis already variadic), the way the web app's toolbar acts on a selection. Without a selection it behaves exactly as before.How
postingActionDoneMsggainspostingIDs, every posting a bulk action took. The box list, the Previously Seen screen and the overlaid search/bundle lists iterate it, falling back to the singlepostingIDfor every existing action.contentList.removeAtnow drops the removed row from the selection. A successful bulk trash therefore clears the selection by itself, and a failed request leaves it standing for another try.docs/tui.mdnotes thattacts on the selection when there is one.Related: #330 asks for the same over seen/unseen. This only wires
t, since that was the itch; the samepostingIDspath would carry the other keys.Tests
TestMailViewTrashesSelectedThreadsInOneRequest: two selected rows, one request with[100, 101], both rows gone, selection empty, toast reads "2 threads moved to Trash".TestMailViewTrashFailureKeepsSelection: a 500 leaves both rows and the selection in place.make checkpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01LZgWZQHxm7KdZNLNjxCtQG
Summary by cubic
Fixes the TUI so
ttrashes every selected thread in one request when there is a selection, instead of only the row under the cursor; without a selection it behaves exactly as before.docs/tui.mdnotes the new behavior.tis wired; the same path can carry the other filing keys later.Written for commit dcd5a45. Summary will update on new commits.