plan/phase26-edit-history #125

Merged
longjacksonle merged 8 commits from plan/phase26-edit-history into main 2026-05-18 01:19:54 +02:00
No description provided.
Wire `update_message_body` into a transaction that archives the prior body to `message_edits` before overwriting the live row, add `list_message_edits` to retrieve the history oldest-first, and propagate migration 0025 to all affected test pool helpers.
Clicking "(edited)" on a message now opens a right-side drawer listing all prior bodies alongside the current one. The "(edited)" span becomes an hx-get button targeting #history-panel; a DELETE /history-panel route closes the drawer by swapping in an empty aside.

Prior bodies resolve @username chips via a new `mentions_for_body` helper that queries auth.users directly, bypassing the denormalized `mentions` table. That table is reconciled to the current body, so a user unmentioned by a later edit has no row there to look up; going direct means the chip still renders in the prior entry. The current body continues to use the live-path `mentions_for_messages` for consistency with the room timeline.

Template labels ("Edited <ts>", "Current", "Current - last edited <ts>") are pre-computed in the handler so the template stays branch-free and avoids introducing the first `{% match %}` in any template.
Cover `list_message_edits` at the db layer (single edit, two edits
chronological order, unedited returns empty) and add a new
`routes_message_edit_history` integration suite for the
`GET /messages/:id/history` endpoint: auth guard, private-room access
control, soft-deleted 404, oldest-first ordering, Current label
formatting, markdown rendering in prior bodies, and mention-chip
behaviour across edits.
Both surfaces are invisible until they fail. enforce_2fa_enrollment
middleware activates when AppState.secret_key.is_some() and 303s every
authed request to /settings/2fa/setup when the user has totp_enabled=0.
db::enclave::backfill_general_membership early-returns when no admin
exists, leaving freshly-created non-admin users out of the General
enclave and 403'ing every POST /room/1/messages. Discovered during phase
26's Task 6 test harness setup; documented in CLAUDE.md so future
test-binary authors do not rediscover the same gotchas.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
style: cargo fmt cleanup across phase 26 work
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m4s
dad6052bbe
Mechanical rustfmt fixes surfaced by just check-fmt at the end of Task 6.
No behavior change; just reflows around ensure_tempdir, the sql variable
binding in mentions_for_body, and a few indentation tweaks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
longjacksonle deleted branch plan/phase26-edit-history 2026-05-18 01:19:54 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!125
No description provided.