Repository navigation
test(site): add a pending add story for the project access dialog - #31247
Conversation
|
@codex review |
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: 5741ebe042
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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 chat project ACL response now includes the project's owner, so the
project page can show who owns a project to everyone who can read it.
`GET
/api/experimental/organizations/{organization}/chats/projects/{project}/acl`
returns a new `owner` field (`MinimalUser`). The owner is never in
`users`, and `GET /api/v2/users/{id}` returns 404 to regular
organization members, so project members and project admins currently
see the owner as "Unknown". The handler loads the owner with a
system-restricted context after the existing read and sharing-disabled
checks, matching how it already loads shared users and groups.
`TestChatProjectSharing/User` and `/Admin` now check the owner as seen
by the owner, a `use` sharee and an `admin` sharee, and that both
sharees still get 404 from the users endpoint. Dogfood UAT on a dev
deployment confirmed the field for all three callers, no owner data for
callers without access (404), and the unchanged 403 when chat sharing is
disabled.
Stack (merge bottom first):
- 👉 this PR
- #31245
- #31246
- #31247
Adds a members section to the chat project Details panel and a read-only "View access" dialog. - The Details card gets a members section at the bottom: "N members[, G groups]" (the owner plus directly shared users; groups are counted separately), a row of avatars with name tooltips, and a "View access" button. The row shows as many avatars as fit the card's width (up to eight) and ends with a "+K" tile for the rest; its tooltip lists up to ten hidden names and "and N more". Member tooltips let clicks through, so they never block the button. - The dialog lists the owner first with an Owner badge, then shared users and groups (sorted naturally by name) with their role. The `use` role shows as "Member" and `admin` as "Admin". A footnote explains that chats in the project start private. - The owner's name and avatar come from the new `owner` field on the ACL response (#31244), so project members and admins see the real owner in the "Project owner" row too, instead of "Unknown". - The section is hidden when chat sharing is disabled (the ACL endpoint returns 403). Loading shows skeletons; other errors show an alert with Retry in both the panel and the dialog. - Adds `getChatProjectACL` to the API client and a `chatProjectACL` query. Editing access comes in #31246. Dogfood UAT passed on a dev deployment: owner, `use` and `admin` viewers all see the owner and the same members list with no users requests, counts and "+K" overflow are correct, the row fits the card from 320 to 1440px with the sidebar open or collapsed, tooltips never swallow the button click, the section hides with `--disable-chat-sharing`, and ACL errors recover with Retry. | Members section (member's view) | View access dialog | | --- | --- | | <img alt="Details panel with the members section, as a project member" src="https://raw.githubusercontent.com/coder/coder/assets/pr-31245-project-members/pr/members-section.png" width="600" /> | <img alt="View access dialog listing owner, admin, member and Everyone" src="https://raw.githubusercontent.com/coder/coder/assets/pr-31245-project-members/pr/view-access-dialog.png" width="600" /> | Stack (merge bottom first): - #31244 - 👉 this PR - #31246 - #31247
) Lets project owners and project admins manage who can access a chat project from the project page. - The Details panel button reads "Manage access" when the viewer can share the project (`permissions.share`), otherwise "View access". The dialog title follows. - In manage mode the dialog gets an add row (user or group picker, a Role select offering Member and Admin that defaults to Member and resets to it after each add, and an Add button that stays disabled until a user or group is picked). The picker has no nested clear control, and its accessible name includes the current selection. Each shared user and group gets a role select and a menu with Remove. Changes apply immediately through `PATCH .../acl`. The owner row and the viewer's own row stay read-only, and the picker never offers the owner, the viewer, or anyone already listed. - While a change saves, every row control and Add are disabled. Focus returns to the row's role select after a role change, to the row's menu after a failed remove, and to the picker after an add or a successful remove. - Failed changes show an alert above the table. A 403 explains the viewer can no longer change access, and after any change the project and its ACL refetch, so a viewer who lost admin (including by demoting a group they're in) drops to "View access" without a reload. - On phones each row stacks the name above its controls so names stay readable; the column headers stay available to screen readers. - Adds `updateChatProjectACL` to the API client and a single `setChatProjectRole` mutation for users and groups. Dogfood UAT passed across ten rounds on a dev deployment, covering owner, admin and member views, every add/change/remove path with request bodies checked against `GET .../acl`, the pending, 403 and 500 states, focus targets at local speed and with a delayed save, keyboard use, and 320 to 1440px layouts. Not covered: adding a group through the picker, which needs a license; a group row was added through the API and edited in the UI. Follow-ups left out to stay under the PR size limit: drop the `useId` wrapper around the dialog (re-indents ~80 lines), move the access mutation logic into a hook, and a story for the pending add state (next PR). | Manage access (owner) | Phone layout | | --- | --- | | <img alt="Manage access dialog with add row, role selects and row menus" src="https://raw.githubusercontent.com/coder/coder/assets/pr-31246-manage-access/pr/manage-access.png" width="600" /> | <img alt="Manage access dialog at 375px with stacked rows" src="https://raw.githubusercontent.com/coder/coder/assets/pr-31246-manage-access/pr/manage-access-phone.png" width="280" /> | Stack (merge bottom first): - #31244 - #31245 - 👉 this PR - #31247
094964d to
bc47cf9
Compare
Adds a
ManagePendingAddstory to the project access dialog so Pixel captures the in-progress add state: a group and role picked in the add row while the add saves, with the Add button showing its spinner and the add-row role control disabled.This was split out of #31246, which is at the 1000-line limit; its Vitest coverage already checks that a pending add blocks further changes.
Stack (merge bottom first):