vinterliste/tests
Ole-Morten Duesund bbb5ad2bdd feat(activity): "Gjort" mark with statistics
Per-user "I've done this" toggle alongside hearts and bookmarks.
Hearts express approval; gjort expresses completion. Both contribute
to public statistics so readers can see what people LIKE versus what
people actually DO.

Backend:
- New activity_done table (composite PK on activity_id + user_id,
  CASCADE on both refs, mirrors activity_hearts).
- POST/DELETE /api/activities/:id/done. Unlike heart/bookmark, "gjort"
  works on every visibility the viewer can see — private (owner-only,
  acts as a personal todo checkbox), friends-only (mutual-friend +
  no-block check, mirrors GET /:id), public, semi. Non-viewers get
  404 to avoid leaking existence.
- buildBulkLookups + serialize extended with done_count + viewer_done
  so the list endpoint stays at constant queries per render.
- Public-list endpoint (server/users.ts) bulk-fetches done counts
  alongside heart counts; viewer_done is always false (unauth view).

Types: Activity{Public,Semi,Private,Friends} all gain done_count +
viewer_done. Private's count is at most 1 (only the owner can write).

UI: new "✓ Gjort" / "☐ Gjort" button in the action row with the same
optimistic-toggle + localOverride pattern as hearts. Anonymous viewers
on public activities see a muted "✓ N" stat. Title hint clarifies
the intent: "Dette har jeg gjort" vs "Du har gjort dette."

Tests: 2 new in engagement.test.ts — toggle + idempotency on public,
owner-only access on private (non-owner gets 404).
2026-05-25 19:00:26 +02:00
..
activities.test.ts Drag-and-drop unified activity list with per-user sort order 2026-05-25 16:47:55 +02:00
admin.test.ts feat(tags): moderators and admins can delete public tags 2026-05-25 17:57:33 +02:00
auth.test.ts Close the recovery lockout-DoS hole on /auth/recovery-complete 2026-05-25 12:28:26 +02:00
crypto.test.ts Scaffold Vinterliste — end-to-end encrypted winter activity list 2026-05-25 12:27:14 +02:00
engagement.test.ts feat(activity): "Gjort" mark with statistics 2026-05-25 19:00:26 +02:00
friends.test.ts test(friends): lock in directional visibility semantics 2026-05-25 15:02:57 +02:00
helpers.ts test: coverage for all major server features 2026-05-25 15:37:53 +02:00
profile.test.ts test: coverage for all major server features 2026-05-25 15:37:53 +02:00
social.test.ts fix(invites): build share URL on the client, not the server 2026-05-25 16:25:55 +02:00