Rail and drawer: only the 5 tags most recently used or viewed (#5931)
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 2s
CI & Build / Python lint (push) Successful in 3s
CI & Build / Web typecheck and unit tests (push) Successful in 12s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
CI & Build / Python tests (push) Successful in 14s
Android / Core and FFI clippy and tests (push) Successful in 1m9s
CI & Build / integration (push) Successful in 2m10s
CI & Build / Build & push image (push) Skipped
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 3m25s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m20s
Android / Kotlin + Rust (APK) (push) Failing after 6m3s
Android / Build the server image (push) Skipped
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m5s
Desktop (Tauri) / Update manifest (push) Successful in 4s

A long tag list pushed the drawer's Archive, Trash and Sync off screen on
Android, where Tags still sat above them (#5915 only reordered the web rail).
Tags now come last on Android too, and both clients list the five tags most
recently used or viewed, by name, with "All tags (N)" opening the rest in
place.

Used: the newest untrashed note carrying the tag. GET /api/labels and the
core's list_labels return it as last_used, and each client also folds in the
notes it holds, so a tag applied a moment ago counts before the next listing.
Viewed: opening the tag's lens, remembered on the device (per user on the web).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 14:41:33 -04:00
co-authored by Claude Opus 5.5
parent 74d0d3d88e
commit ea831d1857
14 changed files with 428 additions and 21 deletions
+20
View File
@@ -665,6 +665,26 @@ async def _push_label(app_client, lid: str, op: str, edited_at: str, name: str =
return (await resp.get_json())["results"][0]
async def test_a_tag_listing_says_when_each_was_last_used(app_client, db):
"""The rail keeps the most recent few (#5931): a tag is as recent as the newest
note carrying it, and a note in the trash does not count."""
await _signed_in(app_client, "lastused")
used = await (await app_client.post("/api/labels", json={"name": "errands"})).get_json()
idle = await (await app_client.post("/api/labels", json={"name": "someday"})).get_json()
binned = await (await app_client.post("/api/labels", json={"name": "old"})).get_json()
note = await (await app_client.post("/api/notes", json={"body": "milk"})).get_json()
await app_client.put(f"/api/notes/{note['id']}/labels", json={"label_ids": [used["id"]]})
gone = await (await app_client.post("/api/notes", json={"body": "stale"})).get_json()
await app_client.put(f"/api/notes/{gone['id']}/labels", json={"label_ids": [binned["id"]]})
assert (await app_client.post(f"/api/notes/{gone['id']}/trash")).status_code == 200
listing = {lb["id"]: lb for lb in (await (await app_client.get("/api/labels")).get_json())["labels"]}
current = (await (await app_client.get(f"/api/notes/{note['id']}")).get_json())["updated_at"]
assert listing[used["id"]]["last_used"] == current
assert listing[idle["id"]]["last_used"] is None
assert listing[binned["id"]]["last_used"] is None
async def test_a_tag_deleted_on_the_web_reaches_devices_as_a_tombstone(app_client, db):
await _signed_in(app_client, "webdelete")
tag = await (await app_client.post("/api/labels", json={"name": "grocery"})).get_json()