Repository navigation
fix(web): show the server Owner's role as "owner" instead of "admin" - #1549
Conversation
- Add accountRoleLabel so the Owner is labeled "owner" everywhere a role is shown - Replace the separate Owner badge with the role badge on the users list and detail header - Show "owner" in the Account panel and the disabled role selects of both edit forms
|
Warning Review limit reachedNext included review available in 2 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44d20f5bdc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /** The role shown for an account: the Owner is labeled "owner" rather than "admin". */ | ||
| export function accountRoleLabel(account: AdminUser): string { | ||
| return account.is_owner ? "owner" : account.role; |
There was a problem hiding this comment.
Apply the owner label to the dashboard widget
When the owner is among the eight accounts shown on the admin dashboard, UsersWidget still checks u.role === "admin" and renders an admin badge (web/src/components/admin/dashboard/widgets/UsersWidget.tsx:89-92). This leaves a prominent admin UI displaying the conflicting role that this helper is intended to replace; use accountRoleLabel there as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 71fb945: UsersWidget now uses accountRoleLabel, so the dashboard shows the Owner as "owner".
| <Badge variant={u.role === "admin" ? "default" : "secondary"}> | ||
| {accountRoleLabel(u)} |
There was a problem hiding this comment.
Sort roles by the displayed owner label
When an administrator sorts the Role column, this cell now displays owner, but sortAdminUsers still compares the stored a.role/b.role, where the owner remains admin. With an owner and one or more ordinary admins, the owner is therefore interleaved with admins by username instead of being ordered by the visible admin, owner, and user values, despite the column reporting an ascending or descending sort.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 71fb945: the Role sort now compares accountRoleLabel, so the order matches the labels shown.
|
Minor re-check: the Owner now appears as “owner” instead of “admin” plus a separate Owner badge in the validated Users/detail flows. The role API, group restrictions, and impersonation authorization are unchanged; re-check #1197 C1/C2 and #1200 C1/C2 after merge. Suggested fix: replace Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Keeping |
Problem
Closes #1382
Related issue: N/A
Validation tasks: none
This follows up on review feedback on #1382. The admin Users pages showed the server Owner's role as "admin" with a separate "Owner" badge next to it. The account detail page showed "admin" in its Role row, and the disabled Role select in the edit forms showed "Admin". An admin looking at the Owner's account saw two roles that seemed to conflict, and the edit form said nothing about ownership. This change labels the Owner's role "owner" everywhere the web admin UI displays a role.
Approach
A new
accountRoleLabelhelper inweb/src/lib/accountOwner.tsreturns "owner" for the Owner account and the stored role for every other account. The Users table and its Role sort, the dashboard Users widget, the detail page header, and the Account panel all use this helper, which replaces the separate "Owner" badge. For the Owner, both edit forms add an "Owner" option to the Role select and show it as selected. That select was already disabled for the Owner, so the added option only changes what it displays.This is a display-only change. The API still reports the Owner as
role: "admin"withis_owner: true, and permission checks still read those fields. Badge styling still keys offrole, so the Owner's badge keeps the admin style.Validation
AdminUsersandAdminUserDetailowner cases to expect "owner" and no "admin" label for the Owner row and detail page.AdminUsersandAdminUserDetailVitest suites (70 tests pass), the web typecheck, and Prettier and ESLint on the changed files.Risks
None identified. The change is limited to the web admin UI. No API, jellycompat, or native client changes.
Checklist
AI Disclosure
Note
Show server owner role as "owner" instead of "admin" in web admin UI
Adds an
accountRoleLabelhelper in accountOwner.ts that returns "owner" for accounts withis_ownerset, and uses it across the admin UI.sortAdminUserssorts by display label; owner rows and detail views no longer render "admin" text, as asserted in the updated testsMacroscope summarized 71fb945.