Search: all results with a real count; bulk actions on results stay done

Search showed at most the first 50 matching messages ("1–50 of 50"). The
first page now carries the number of matching conversations, further pages
load as the list is paged through (a conversation spanning two appears once;
oldest-first loads them all, up to 40 pages), and the Unread/Pinned tabs filter
on the server, so their count covers every result.

Bulk Delete / Archive / Restore over selected results acts at once: the rows
leave the list (greyed instead when archived from a search, which still finds
them), the search results are refreshed, and the reading pane returns to
"Select a conversation". Each move landing on the server refreshes them again,
and a hidden row only comes back when no move has landed for 30 seconds — a
long batch no longer brings deleted results back.

Settings → Accounts → Notifications: shorter description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 21:15:06 +02:00
co-authored by Claude Opus 5.5
parent 9c08cbb140
commit 5bf8fc81f6
9 changed files with 230 additions and 37 deletions
+41
View File
@@ -245,3 +245,44 @@ async def test_negation(seeded: Ctx) -> None:
async def test_combined_operators(seeded: Ctx) -> None:
assert await _search(seeded, "from:dave has:attachment") == 1
assert await _search(seeded, "from:bob has:attachment") == 0
async def test_more_than_one_page_counts_and_pages(ctx: Ctx) -> None:
"""Beyond the first page: the first page says how many conversations match
in all, the cursor brings the rest, and Unread/Pinned filter conversations."""
for i in range(7):
await _ingest(
ctx,
frm=f"Sender {i} <s{i}@example.org>",
subject=f"Quarterly report {i}",
body="numbers inside",
flags=frozenset({"\\Seen"}) if i % 2 else frozenset(),
)
await _ingest(ctx, frm="Other <o@example.org>", subject="Lunch", body="nothing")
first = (await ctx.client.get("/api/search", params={"q": "quarterly", "limit": 3})).json()
assert first["total"] == 7 and len(first["threads"]) == 3 and first["cursor"]
seen = {t["thread"]["id"] for t in first["threads"]}
cursor = first["cursor"]
while cursor:
page = (
await ctx.client.get(
"/api/search", params={"q": "quarterly", "limit": 3, "cursor": cursor}
)
).json()
assert page["total"] is None # counted once, on the first page
seen |= {t["thread"]["id"] for t in page["threads"]}
cursor = page["cursor"]
assert len(seen) == 7
unread = (
await ctx.client.get("/api/search", params={"q": "quarterly", "filter": "unread"})
).json()
assert unread["total"] == 4 and len(unread["threads"]) == 4
assert all(t["thread"]["unread_count"] > 0 for t in unread["threads"])
pinned = (
await ctx.client.get("/api/search", params={"q": "quarterly", "filter": "pinned"})
).json()
assert pinned["total"] == 0 and pinned["threads"] == []
bad = await ctx.client.get("/api/search", params={"q": "quarterly", "filter": "nope"})
assert bad.status_code == 422