Skip to content

TUI: trash every selected thread with t - #416

Open
bulters wants to merge 1 commit into
basecamp:mainfrom
bulters:tui-bulk-trash
Open

TUI: trash every selected thread with t#416
bulters wants to merge 1 commit into
basecamp:mainfrom
bulters:tui-bulk-trash

Conversation

@bulters

@bulters bulters commented Sep 8, 2026

Copy link
Copy Markdown

What

Space already selects threads in the TUI, but only Ctrl+B (bulk reply) acted on the selection. t and the other filing keys took the row under the cursor, so trashing a handful of threads meant one keypress per row.

With a selection, t now trashes every selected thread in a single POST /postings/trash (the SDK's MoveToTrash is already variadic), the way the web app's toolbar acts on a selection. Without a selection it behaves exactly as before.

How

  • postingActionDoneMsg gains postingIDs, 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 single postingID for every existing action.
  • contentList.removeAt now 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.md notes that t acts 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 same postingIDs path 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 check passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LZgWZQHxm7KdZNLNjxCtQG


Summary by cubic

Fixes the TUI so t trashes 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.

  • A successful trash clears the selection; a failed request leaves it standing for another try.
  • The done message now carries every posting a bulk action took, so the box list, Previously Seen screen, and overlaid search/bundle lists drop each affected row, and docs/tui.md notes the new behavior.
  • Adds tests for the one-request bulk trash and for a failed request keeping the selection.
  • Only t is wired; the same path can carry the other filing keys later.

Written for commit dcd5a45. Summary will update on new commits.

Review in cubic

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
@bulters
bulters requested a review from a team as a code owner September 8, 2026 12:57
Copilot AI balanced review requested due to automatic review settings September 8, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to 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.

Comment thread internal/tui/mail.go
boxID int64
sourceKind mail.Kind
postingID int64
postingIDs []int64 // every posting a bulk action took, empty for a single row's
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants