vinterliste/server
Ole-Morten Duesund fb193b4914 fix(activities): preserve viewer's sort_position on single-row fetches
Toggling "gjort" (and heart, and bookmark, and edit, and GET /:id)
silently reset the row's effective sort_position to -created_at,
wiping any custom drag-sort the viewer had applied to that row.
The list endpoint joins user_activity_sort to get the per-viewer
position; single-row endpoints were doing plain
`SELECT * FROM activities WHERE id = ?` and serialize() was falling
back to -created_at when sort_position was missing from the row.

User-visible effect on the private list (which often has custom
ordering since it's the user's todo list): toggling a checkbox made
that row jump back to its created_at slot.

Fix: fetchRowForViewer(id, viewerId) helper that does the same
LEFT JOIN as the list query. Routed through every single-row return
path — GET /:id, POST /, PATCH /:id, POST/DELETE /:id/heart,
POST/DELETE /:id/bookmark, POST/DELETE /:id/done.

Regression test covers heart + done + GET-by-id all preserving a
custom sort_position written via PATCH /:id/sort.
2026-05-25 19:46:24 +02:00
..
activities.ts fix(activities): preserve viewer's sort_position on single-row fetches 2026-05-25 19:46:24 +02:00
admin.ts Admin role, root/home URL split, activity permalinks 2026-05-25 13:23:13 +02:00
auth.ts External profile links (max 5 per user) 2026-05-25 16:20:04 +02:00
db.ts feat(activity): "Gjort" mark with statistics 2026-05-25 19:00:26 +02:00
feedback.ts fix(feedback): stop exposing done_by user id in API responses 2026-05-25 13:54:07 +02:00
friends.ts Friends + friends-only visibility + blocking 2026-05-25 14:47:20 +02:00
index.ts refactor: Norwegian URL paths 2026-05-25 18:20:50 +02:00
invites.ts fix(invites): build share URL on the client, not the server 2026-05-25 16:25:55 +02:00
og.ts refactor: Norwegian URL paths 2026-05-25 18:20:50 +02:00
roles.ts Admin role, root/home URL split, activity permalinks 2026-05-25 13:23:13 +02:00
session.ts Scaffold Vinterliste — end-to-end encrypted winter activity list 2026-05-25 12:27:14 +02:00
settings.ts Self-registry toggle, invite links with attribution, first-user-admin 2026-05-25 13:45:32 +02:00
tags.ts feat(tags): moderators and admins can delete public tags 2026-05-25 17:57:33 +02:00
users.ts feat(activity): "Gjort" mark with statistics 2026-05-25 19:00:26 +02:00