PR: #495: fix(team): render team role names in role columns [Story-1963]
by @ayush-pramaan
View PR →
Story 1963
Pending, expired, members, and deactivated rows show team role names
The Team page ROLE column now resolves through one shared presentation
helper. Member rows still show firmRole.name. Invitation
rows read publicMetadata.teamRoleId when present, then use
the matching system-default team-role name as the display-only fallback
for legacy invitations.
Invitation contract
-
TeamInvitationnow includes nullableteamRoleId. -
adaptInvitation()readspublicMetadata.teamRoleIdwith UUID validation. Legacy invitations exposenull, not a fabricated write-side value. - The existing capability field remains available only as a display fallback input for old Clerk invitations.
Role cell helper
-
teamRoleCellName()lives insrc/components/settings/team/presentation.ts. -
Invitation rows resolve
teamRoleIdto a role name from the already-loadedfirmRoles.rolescatalog. -
Legacy pending and expired invitations with no
teamRoleIdrender the matching system-default team-role name, such asMemberorSenior Advocate. -
Member and deactivated rows use the same helper and continue to show
firmRole.name, with the localized dash fallback only when no role exists.
Rows and tabs
-
PendingInviteRowresolves the role at the row level, so both Pending and Expired tabs inherit the behavior. -
MemberTableRowresolves through the same helper, so Members and Deactivated tabs stay aligned. - Search text for Team rows now indexes the displayed role name rather than the raw capability.
Stories and tests
-
PendingInviteRowstories include metadata-backed pending, legacy pending withoutteamRoleId, and legacy expired withoutteamRoleId. -
presentation.test.tscoversteamRoleIdprecedence, legacy pending fallback, legacy expired fallback, and deactivated member role-name display. -
server.test.tscovers read-back ofpublicMetadata.teamRoleIdand null legacy invites.
Acceptance criteria
- Pending ROLE shows team-role names. met
- Expired ROLE uses the same row-level fallback. met
- Members and Deactivated use the shared helper. met
- No capability label renders as the list ROLE cell. met
- New i18n fallback key exists in English and Hindi. met
Verification
-
pnpm lintpassed with one pre-existing warning insrc/components/add-matter/avatar.tsx. pnpm testpassed: 155 files, 981 tests.pnpm buildpassed.pnpm storybook:buildpassed.git diff --checkclean.
Files changed
16 file(s), +278 / -34 lines
| Path | Role | + | - |
|---|---|---|---|
| messages/en.json | Config | +1 | -0 |
| messages/hi.json | Config | +1 | -0 |
| src/components/settings/team/member-table-row.tsx | Component | +5 | -1 |
| src/components/settings/team/pending-invite-row.stories.tsx | Component | +11 | -3 |
| src/components/settings/team/pending-invite-row.tsx | Component | +12 | -2 |
| src/components/settings/team/pending-invites-table.stories.tsx | Component | +3 | -1 |
| src/components/settings/team/pending-invites-table.tsx | Component | +4 | -0 |
| src/components/settings/team/presentation.test.ts | Component | +85 | -2 |
| src/components/settings/team/presentation.ts | Component | +86 | -12 |
| src/components/settings/team/team-fixtures.ts | Component | +12 | -5 |
| src/components/settings/team/team-list-content.tsx | Component | +1 | -0 |
| src/components/settings/team/team-list-page.tsx | Component | +4 | -2 |
| src/lib/team-invitations/reconcile.test.ts | Library | +1 | -0 |
| src/lib/team-invitations/schema.ts | Library | +4 | -1 |
| src/lib/team-invitations/server.test.ts | Library | +33 | -0 |
| src/lib/team-invitations/server.ts | Library | +15 | -5 |