Skip to content

GET /fmsg/count: how many threads the identity has - #65

Merged
markmnl merged 1 commit into
mainfrom
thread-count
Nov 1, 2026
Merged

markmnl merged 1 commit into
mainfrom
thread-count

Conversation

@markmnl

@markmnl markmnl commented Nov 1, 2026

Copy link
Copy Markdown
Owner

A small read route, so a client can show "93 of 8,324 threads" while it pages through GET /fmsg and GET /fmsg/sent.

  • How it counts: one query. It finds the sent messages the identity can see (sender, to, or add_to recipient), applies the same trash filter as the list (?trash=exclude|include|only, default exclude), and counts those whose parent isn't also visible. That matches how clients group threads from listed messages. Drafts don't count.
  • Response: {"threads": N}.
  • OAuth: read scope for delegated tokens; the route-sync test passes.
  • Docs: README route row and section.

Tests (Postgres 17):

  • per-identity counts, with replies in the same thread and drafts excluded;
  • an outsider gets 0;
  • a trashed thread leaves the default count and appears under only and include;
  • a bad trash value gets 400.

go test ./... passes.

🤖 Generated with Claude Code

Lets a client show "93 of 8,324 threads" while it pages through the
lists. Each sent message the identity can see (sender, recipient or
added recipient) whose parent it can't also see starts a thread, which
is how clients group threads from listed messages; drafts don't count.
?trash= as for GET /fmsg. Read scope for delegated OAuth tokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markmnl
markmnl merged commit 58005ae into main Nov 1, 2026
1 check passed
@markmnl
markmnl deleted the thread-count branch November 1, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant