Skip to content

feat(admin): show full name beside username in client authorizations#197

Merged
appleboy merged 3 commits into
mainfrom
feat/client-auth-fullname
May 26, 2026
Merged

feat(admin): show full name beside username in client authorizations#197
appleboy merged 3 commits into
mainfrom
feat/client-auth-fullname

Conversation

@appleboy
Copy link
Copy Markdown
Member

Summary

The admin client authorizations view (/admin/clients/:id/authorizations) showed only each authorizing user's username. This PR adds the user's full name in parentheses beside it — username (fullname) — so admins can identify users at a glance. When a user has no full name, the display falls back to username alone.

The User model already stored FullName; it simply wasn't carried into this view. This PR threads it through the existing chain.

AI Authorship

  • No AI was used in this PR
  • AI was used. Details:
    • Tool / model: Claude Opus 4.7 (1M context) via Claude Code
    • AI-authored files: all 5 changed files
    • Human line-by-line reviewed: none yet — reviewer attention requested

Change classification

  • Leaf node (local impact) — a single read-only admin view. No change to auth, token issuance, schema, or any shared path. Worst case is a cosmetic rendering issue on one page.
  • Core code

Plan reference

No plan.md. Goal: show username (fullname) instead of bare username in the client authorizations User column, gracefully omitting the parenthetical when no full name exists.

Verification

  • Unit tests — added TestListClientAuthorizations_ResolvesUserDetails covering a user with a full name (resolves Username + FullName + Email) and a user without one (FullName stays empty)
  • Existing ListClientAuthorizations tests still pass
  • Stress / soak test: N/A
  • Also verified: make generate (clean), make fmt (clean), make build (OK), make lint (0 issues)
  • Manual verification for reviewer: open /admin/clients/<id>/authorizations for a client with consenting users; confirm users with a full name render username (fullname) and users without one render just username. The generated templ emits a literal space, so it reads alice (Alice Anderson), not alice(Alice Anderson).

Verifiability check

  • Inputs/outputs documented — service view-model field FullName flows handler → props → template
  • Reviewer can judge correctness from the one-field addition across the four layers plus the new test
  • Failures would surface as a visible rendering difference on the page / in the test

Risk & rollback

  • Risk: Minimal. Read-only display change on one admin page; no data, schema, or behavior changes. The parenthetical is conditional, so an empty FullName can't produce stray ().
  • Rollback: Single commit — git revert or close the PR. No migrations.

Reviewer guide

  • Read carefully: internal/templates/admin_client_authorizations.templ — the conditional render (confirm the space between username and the parenthetical) — and internal/services/authorization.goFullName population in ListClientAuthorizations.
  • Spot-check OK: internal/handlers/client.go, internal/templates/props.go (one-field plumbing), and the new test in internal/services/authorization_test.go.

🤖 Generated with Claude Code

- Display the authorizing user's full name in parentheses next to their username on the admin client authorizations view
- Thread FullName from the User model through the authorization service, handler, and page props
- Fall back to username alone when a user has no full name
- Add a service test covering both named and nameless users
Copilot AI review requested due to automatic review settings May 26, 2026 10:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds FullName to the admin client authorizations view-model pipeline so the UI can render username (full name) for easier user identification, with a graceful fallback when the full name is empty.

Changes:

  • Extend the client-authorization display models (UserAuthorizationWithUser, ClientAuthorizationDisplay) to include FullName.
  • Thread FullName through service → handler → template rendering for /admin/clients/:id/authorizations.
  • Add a unit test to verify user detail resolution (username/full name/email) for users with and without a full name.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/templates/props.go Adds FullName to the admin authorizations view model.
internal/templates/admin_client_authorizations.templ Renders full name in parentheses next to username when present.
internal/services/authorization.go Populates FullName when resolving user details for client authorizations.
internal/services/authorization_test.go Adds test coverage for resolved user details (including full name).
internal/handlers/client.go Plumbs FullName into template props for the admin authorizations page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/templates/admin_client_authorizations.templ Outdated
Comment thread internal/services/authorization_test.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/handlers/client.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

- Render the full-name parenthetical via a Go string expression so the
  leading space cannot be collapsed by formatters/minifiers.
- Assert the nameless user's email in the resolution test to guard
  against regressions independent of the FullName case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@appleboy appleboy requested a review from Copilot May 26, 2026 12:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread internal/templates/admin_client_authorizations.templ Outdated
Comment thread internal/services/authorization_test.go
- Move the full-name parenthetical out of the username span so the outer
  span emits no incidental whitespace around the username; the explicit
  concatenated space remains the stable separator.
- Assert exactly two authorizations are returned in the resolution test
  to catch unexpected extra rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@appleboy appleboy requested a review from Copilot May 26, 2026 15:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@appleboy appleboy merged commit d90e42a into main May 26, 2026
21 checks passed
@appleboy appleboy deleted the feat/client-auth-fullname branch May 26, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants