Skip to content

feat(admin): show users per organisation on org detail page#23

Merged
rubenhensen merged 1 commit into
mainfrom
feat/admin-users-per-org
Apr 24, 2026
Merged

feat(admin): show users per organisation on org detail page#23
rubenhensen merged 1 commit into
mainfrom
feat/admin-users-per-org

Conversation

@dobby-coder

@dobby-coder dobby-coder Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a read-only Users table to the admin org detail page ((admin)/admin/organizations/[id]), showing full name, email, phone, and a Contact person badge for the row matching organizations.contact_user_id.
  • Loads users in getOrganizationWithRequests (one query, ordered by full_name) and derives the contact person from that list — dropping the previous second SELECT.
  • Empty state: "No users belong to this organisation yet." when the org has zero users.

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

git fetch origin && git checkout feat/admin-users-per-org && npm install && docker compose up -d db && npm run dev

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 check green.
  • No schema changes, no migrations, no new dependencies.

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.find on the already-fetched list), and the empty-state is guarded by #if data.users.length === 0. Flip to ready once a maintainer eyeballs it.

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).
@rubenhensen rubenhensen marked this pull request as ready for review April 24, 2026 07:06
@rubenhensen rubenhensen merged commit 9f12bd8 into main Apr 24, 2026
7 checks passed
@rubenhensen rubenhensen deleted the feat/admin-users-per-org branch April 24, 2026 07:16
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.

Admin panel: show users per organisation

1 participant