feat(room): per-room nickname (LC-321) #337
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-321-per-room-nickname"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Per-room nickname: a user can set a display name that applies only within one room, overriding their global display name (and username fallback) wherever their messages render in that room. Implements LC-321 / LC-322. Their
usernameis untouched, so @mentions, DM deep-links, and avatar initials keep working.How
routes::load_author_meta. It (and its wrapperresolve_msg_author) now take aroom_id; for the real-user branch only,display_nameis replaced with the per-room nickname when one is set. Synthetic actors (webhook/email/bridge) return before this, so they never pick up a nickname. NoMessageViewshape change: the room page, DM page, the three live WS renders, and thread/edit renders all get the nickname for free. The page builder's per-author cache is per-room-render, so caching the nickname-folded meta is correct.chat.db::room_nicknames(migration0062, PKroom_id+user_id,room_idcascades;user_idreferences auth.db so no cross-db FK, matchingroom_members).db::room_nicknamesexposesset(upsert, 32-char cap -> typed error),clear,get,for_room.POST /room/{id}/nicknameis self-only and room-access-gated; empty/absent field clears. The sharedroom/nickname_section.htmlpartial is rendered by both the page and the POST response, swapping#room-nicknamein place.room.ftlkeys, en/es parity.Scope / assumptions
Testing
just check(clippy standalone + saas, fmt) clean.just testandjust test-saasgreen. Newdb_room_nicknames.rscovers set/get/clear roundtrips, upsert-replace, clear no-op, per-room scoping, the 32-char cap (reject + exact-max), andfor_room.Operator impact
None. No new env var, config, or contract change; no
[operator-action]marker.🤖 Generated with Claude Code
Let a user set a nickname that applies only within one room, overriding their global display name (and username fallback) wherever their messages render in that room. Their username is unchanged, so @mentions, DM deep-links, and avatar initials keep working. The override folds into the single author-label resolution point: `load_author_meta` (and its wrapper `resolve_msg_author`) gain a `room_id` and, for the real-user branch only, replace `display_name` with the room nickname when one is set. Synthetic actors (webhook/email/bridge) return before that, so they never pick one up. No MessageView shape change; all message renders (page, DM, the three live WS renders, thread/edit) get the nickname for free. Storage is a new `chat.db::room_nicknames` table (migration 0062, PK room_id+user_id, room_id cascades). The viewer sets/clears their own nickname on the room info docs tab via `POST /room/{id}/nickname` (self-only, room-access-gated, empty = clear); the shared `room/nickname_section.html` partial swaps in place. 32-char cap. en/es parity. Live-update bound: new and edited messages pick up the nickname immediately; messages already painted in an open tab keep the old label until the next render or reload (a full-backlog re-render is deliberately not attempted). #LC-321 #LC-322 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>