feat(admin): show users per organisation on org detail page#23
Merged
Conversation
Closes #17. Loads users for the org (ordered by full_name) in getOrganizationWithRequests and renders a read-only table under the org header: name, email, phone, contact-person badge. "No users yet" state when the org has none. Dedupes the contact-person query: contactPerson is now resolved from the already-fetched users list instead of a second SELECT. Admin-only (already gated by the (admin) layout). Read-only by design — user CRUD is handled by org members via the portal /portal/members page (#15). Verified with svelte-check (0 errors) and vitest (26 passed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Userstable to the admin org detail page ((admin)/admin/organizations/[id]), showing full name, email, phone, and aContact personbadge for the row matchingorganizations.contact_user_id.getOrganizationWithRequests(one query, ordered byfull_name) and derives the contact person from that list — dropping the previous second SELECT.Closes #17.
Why
Admins currently see only the contact person on the org detail page. When triaging a support ticket, they often need to check who else is on the org — especially now that #15 has landed with multi-user organizations and portal member management.
Read-only by design: user CRUD is owned by org members via
/portal/members, per the direction from #15. Admins observe, they don't manage per-user state here.Reviewer quickstart
Then visit
/admin/organizations/<id>on an org that has multiple users (the seed script creates one for the demo org after #15).Verification
svelte-check: 0 errors, 0 warnings.npx vitest run: 26 tests pass (unchanged).npm run checkgreen.Status
Draft pending local visual check by a maintainer — I cannot easily seed a multi-user org in the Coder workspace, and the screenshot I would otherwise attach needs a live admin session. The logic is exercised by existing code paths (
users.findon the already-fetched list), and the empty-state is guarded by#if data.users.length === 0. Flip to ready once a maintainer eyeballs it.