#443 Let Users Edit Their Name From The User Dropdown - #498
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cielbellerose
left a comment
There was a problem hiding this comment.
Code Review — Cycle 1 · approved
0 open — clean
|
@b-at-neu Is there a reason not to save their current name when they apply just in case? If not this is good to merge |
@cielbellerose |
Revision — Cycle 4fixed R4-M1, R4-M2 · c1715f7 |
cielbellerose
left a comment
There was a problem hiding this comment.
Code Review — Cycle 5 · approved
0 open — clean
c1715f7 to
b069329
Compare
Rebase conflict resolvedAfter #512 merged into Resolution: took Pushed as |
cielbellerose
left a comment
There was a problem hiding this comment.
Code Review — Cycle 6 · approved
0 open — clean
Reuses the existing setUserName action and nameSchema; warns that a rename propagates to every application, submitted and decided alike. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Better Auth's updateUser writes the same public.User row through the Prisma adapter, so it was a no-op round trip that only failed for bypass users. setUserName is the single write path now. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Editable profile names mean a display name can drift after a user applies. Freeze it on Application.applicantName at submit time, same pattern as GlobalApplicationAnswer.questionLabel, and prefer it over the live profile name on reviewer-facing read paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ticket #443 now documents the applicant-name snapshot as intended behavior, so update the dialog's warning to match: renaming applies going forward only, and already-submitted applications keep the name on file at the time. Also trims an over-length schema comment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Application.applicantName freezes the name at submission time; show it inline as "Snapshot (Current)" wherever the applicant name appears so a rename since submission stays visible without losing the snapshot. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extracts the applicantName/user.name comparison into lib/utils.ts's getRenamedTo, reused in the application detail page and both table layouts, and adds the same "(current name)" cue to the activity feed and recent-applications widget so it's consistent across every surface that renders a rename-eligible applicant name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Closes #443
Summary
FormDialog, pre-filled with the current name, warning that the rename propagates to every application the user has (submitted and decided included).authClient.updateUsersync from the sign-up name step (name-field.tsx) — Better Auth'supdateUserwrites the samepublic.Userrow through the Prisma adapter, so it was a no-op round trip that only ever failed for bypass users.No new server action, schema, or migration: the dialog submits to the existing
setUserNameaction inprisma/actions/profile.ts, which already authenticates, parsesnameSchema, scopes the write to the caller's own record, and revalidates/profileplus the root layout.Note for review: two of the ticket's acceptance criteria (dropping the
resolveRealUsersession-name read;public.User.nameas the only source of truth) are already satisfied by the prior Better Auth migration —resolveRealUserinlib/auth/server.tsno longer reads a session name at all, since Better Auth owns theUserrow directly. There's no diff there because there's nothing left to remove.Changes
components/features/edit-name-dialog.tsx— new. ClientFormDialogwrapper:nameSchemaresolver, labelled "Full name" input,WarningCalloutwith the propagation warning,setUserNamecall + toasts.components/layouts/user-menu.tsx— rendersEditNameDialoginsideDropdownMenuContentbetween Profile and Theme, trigger is aDropdownMenuItemwithonSelectpreventDefault(keeps the dropdown, and the mobile navSheetbehind it, mounted while the dialog is open); bumped menu item touch targets tomin-h-11on mobile.components/features/name-field.tsx— dropped theauthClient.updateUsersync call, itstoast.warningbranch, and the now-unusedauthClientimport.Testing plan
/applicationsreview view) → the applicant name reflects the rename, including on a decided application./login/bypass): rename succeeds with only the success toast — no "account sync failed" warning./loginname step, saving shows "Name saved", and they're redirected toredirectTo.Automated checks
npm run prettier:check— passnpm run eslint:check— passnpm run tsc:check— passnpm run test:unit— 71 tests pass (Postgres unavailable locally,npm run testcouldn't reachDATABASE_URL)Notes
/profile, and any per-application name snapshot — reviewer-facing views intentionally join toUserlive, so a rename is meant to show up across a user's full application history.DialoginsideDropdownMenuContentinside, on mobile,Sheet), the fix ismodal={false}on theDropdownMenu— not hoisting the dialog out, which would unmount it with the menu/sheet.@radix-ui/react-tooltipdependency andcomponents/ui/tooltip.tsxbundled into this branch's history are an incidental fix for a pre-existingdev-leveltscbreak (unrelated to this PR's feature), tracked separately as tsc broken on dev: markdown-field.tsx references deleted ui/tooltip #510 and now covered by PR #510 Fix tsc Broken On Dev: Markdown Field Tooltip #512. Once #510 Fix tsc Broken On Dev: Markdown Field Tooltip #512 merges and this PR rebases, this bundled copy will likely need to be reconciled with #510 Fix tsc Broken On Dev: Markdown Field Tooltip #512's canonical version — a resolvable conflict on a file with no PR-specific logic.