Skip to content

#443 Let Users Edit Their Name From The User Dropdown - #498

Merged
cielbellerose merged 6 commits into
devfrom
443-let-users-edit-their-name-from-the-user-dropdown
Aug 19, 2026
Merged

#443 Let Users Edit Their Name From The User Dropdown#498
cielbellerose merged 6 commits into
devfrom
443-let-users-edit-their-name-from-the-user-dropdown

Conversation

@cielbellerose

@cielbellerose cielbellerose commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Closes #443

Summary

  • Adds an Edit name item to the user dropdown that opens a FormDialog, pre-filled with the current name, warning that the rename propagates to every application the user has (submitted and decided included).
  • Removes the redundant authClient.updateUser sync from the sign-up name step (name-field.tsx) — Better Auth's updateUser writes the same public.User row 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 setUserName action in prisma/actions/profile.ts, which already authenticates, parses nameSchema, scopes the write to the caller's own record, and revalidates /profile plus the root layout.

Note for review: two of the ticket's acceptance criteria (dropping the resolveRealUser session-name read; public.User.name as the only source of truth) are already satisfied by the prior Better Auth migration — resolveRealUser in lib/auth/server.ts no longer reads a session name at all, since Better Auth owns the User row directly. There's no diff there because there's nothing left to remove.

Changes

  • components/features/edit-name-dialog.tsx — new. Client FormDialog wrapper: nameSchema resolver, labelled "Full name" input, WarningCallout with the propagation warning, setUserName call + toasts.
  • components/layouts/user-menu.tsx — renders EditNameDialog inside DropdownMenuContent between Profile and Theme, trigger is a DropdownMenuItem with onSelect preventDefault (keeps the dropdown, and the mobile nav Sheet behind it, mounted while the dialog is open); bumped menu item touch targets to min-h-11 on mobile.
  • components/features/name-field.tsx — dropped the authClient.updateUser sync call, its toast.warning branch, and the now-unused authClient import.

Testing plan

  • Sign in as a normal user → open the user dropdown (desktop sidebar) → Edit name is present and opens a dialog pre-filled with the current name.
  • Save a new name → toast "Name updated.", dialog closes, sidebar + dropdown label update without a manual reload.
  • Reopen the dialog → pre-filled with the new name.
  • Clear the field and submit → inline "Enter your full name.", dialog stays open, no toast.
  • Paste 101+ characters and submit → inline max-length error; exactly 100 characters saves.
  • Submit a name with leading/trailing spaces → saved trimmed.
  • Keyboard only: Tab to the account trigger, Enter, arrow to Edit name, Enter → focus lands in the input; Escape closes the dialog and focus returns to the Edit name item.
  • Mobile viewport (~375px): open the hamburger sheet → account menu → Edit name → dialog is usable over the sheet, items are comfortably tappable, and after saving the sheet shows the new name.
  • As an admin/manager, open an application submitted by the renamed user (/applications review view) → the applicant name reflects the rename, including on a decided application.
  • Dev bypass user (/login/bypass): rename succeeds with only the success toast — no "account sync failed" warning.
  • Sign-up path regression: a user with no name signing in via OTP still lands on the /login name step, saving shows "Name saved", and they're redirected to redirectTo.

Automated checks

  • npm run prettier:check — pass
  • npm run eslint:check — pass
  • npm run tsc:check — pass
  • npm run test:unit — 71 tests pass (Postgres unavailable locally, npm run test couldn't reach DATABASE_URL)

Notes

@cielbellerose cielbellerose self-assigned this Aug 18, 2026
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aplio Ready Ready Preview Aug 19, 2026 10:04pm

@cielbellerose cielbellerose added ready for review PR ready for review agent reviewing Review agent working (in-flight) and removed ready for review PR ready for review agent labels Aug 18, 2026

@cielbellerose cielbellerose left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Cycle 1 · approved

0 open — clean

@cielbellerose cielbellerose added approved Review passed, ready to merge and removed reviewing Review agent working (in-flight) labels Aug 18, 2026
@cielbellerose

Copy link
Copy Markdown
Collaborator Author

@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

@b-at-neu

Copy link
Copy Markdown
Collaborator

@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
There isn't necessarily a reason. If you want to extend the global application answer schema to auto-store their name on each application I think that's fine as well. I don't think people are going to be changing their names that often to something that can't identify them anymore but you're probably right, would be good to save.

@cielbellerose cielbellerose added needs revision Review found issues that need fixing revising Revise agent working (in-flight) and removed approved Review passed, ready to merge needs revision Review found issues that need fixing labels Aug 18, 2026
@cielbellerose cielbellerose added needs revision Review found issues that need fixing revising Revise agent working (in-flight) and removed revising Revise agent working (in-flight) needs revision Review found issues that need fixing labels Aug 19, 2026
@cielbellerose cielbellerose added revising Revise agent working (in-flight) and removed reviewing Review agent working (in-flight) needs revision Review found issues that need fixing labels Aug 19, 2026
@cielbellerose

Copy link
Copy Markdown
Collaborator Author

Revision — Cycle 4

fixed R4-M1, R4-M2 · c1715f7

@cielbellerose cielbellerose added ready for review PR ready for review agent and removed revising Revise agent working (in-flight) labels Aug 19, 2026
@cielbellerose cielbellerose added reviewing Review agent working (in-flight) and removed ready for review PR ready for review agent labels Aug 19, 2026

@cielbellerose cielbellerose left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Cycle 5 · approved

0 open — clean

@cielbellerose cielbellerose added approved Review passed, ready to merge and removed reviewing Review agent working (in-flight) labels Aug 19, 2026
@cielbellerose
cielbellerose force-pushed the 443-let-users-edit-their-name-from-the-user-dropdown branch from c1715f7 to b069329 Compare August 19, 2026 18:08
@cielbellerose

Copy link
Copy Markdown
Collaborator Author

Rebase conflict resolved

After #512 merged into dev, this branch's incidental bundled copy of components/ui/tooltip.tsx (and its @radix-ui/react-tooltip package.json/lockfile entries) conflicted with #512's now-canonical version — exactly as flagged in this PR's own description.

Resolution: took dev's canonical components/ui/tooltip.tsx (has data-slot attributes matching the current shadcn convention used elsewhere; this branch's copy predated that convention) and dev's package.json/package-lock.json entirely for the tooltip dependency — confirmed via git show 1706d51 -- package.json that this branch's only package.json change was adding that one now-redundant dependency line, so nothing else was at risk of being dropped. npm ci succeeded against the resulting lockfile; prettier/eslint/tsc all pass.

Pushed as b069329.

@cielbellerose cielbellerose added ready for review PR ready for review agent and removed approved Review passed, ready to merge labels Aug 19, 2026
@cielbellerose cielbellerose added reviewing Review agent working (in-flight) and removed ready for review PR ready for review agent labels Aug 19, 2026

@cielbellerose cielbellerose left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Cycle 6 · approved

0 open — clean

@cielbellerose cielbellerose added approved Review passed, ready to merge and removed reviewing Review agent working (in-flight) labels Aug 19, 2026
@cielbellerose cielbellerose removed the approved Review passed, ready to merge label Aug 19, 2026
cielbellerose and others added 6 commits August 19, 2026 18:02
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Review passed, ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let Users Edit Their Name From the User Dropdown

2 participants