diff --git a/ui/src/pages/InviteLanding.test.tsx b/ui/src/pages/InviteLanding.test.tsx index c26174de7e..8dd88e1723 100644 --- a/ui/src/pages/InviteLanding.test.tsx +++ b/ui/src/pages/InviteLanding.test.tsx @@ -506,7 +506,7 @@ describe("InviteLandingPage", () => { }); }); - it("shows the pending approval page with the company icon and linked access instructions", async () => { + it("shows the pending approval page with the company icon and non-clickable access instructions", async () => { acceptInviteMock.mockResolvedValue({ id: "join-1", companyId: "company-1", @@ -553,14 +553,18 @@ describe("InviteLandingPage", () => { expect(container.querySelector('img[alt="Acme Robotics logo"]')).not.toBeNull(); expect(container.textContent).not.toContain("http://localhost/company/settings/members"); - const approvalLinks = Array.from(container.querySelectorAll("a")).filter( + // The "Company Settings → Members" guidance addresses the company admin, + // not the requester. It must render as plain text so the requester cannot + // navigate themselves to /company/settings/members — a route they have no + // permission to view, which renders a misleading "No company access" + // panel and makes the invite flow look broken. See #6784. + const approvalAnchors = Array.from(container.querySelectorAll("a")).filter( (link) => link.textContent === "Company Settings → Members", ); - expect(approvalLinks).toHaveLength(2); - const expectedApprovalUrl = `${window.location.origin}/company/settings/members`; - for (const link of approvalLinks) { - expect(link.getAttribute("href")).toBe(expectedApprovalUrl); - } + expect(approvalAnchors).toHaveLength(0); + const approvalMentions = + container.textContent?.match(/Company Settings → Members/g) ?? []; + expect(approvalMentions).toHaveLength(2); await act(async () => { root.unmount(); diff --git a/ui/src/pages/InviteLanding.tsx b/ui/src/pages/InviteLanding.tsx index b540fc7528..f732085361 100644 --- a/ui/src/pages/InviteLanding.tsx +++ b/ui/src/pages/InviteLanding.tsx @@ -160,7 +160,6 @@ function AwaitingJoinApprovalPanel({ claimApiKeyPath = null, onboardingTextUrl = null, }: AwaitingJoinApprovalPanelProps) { - const approvalUrl = `${window.location.origin}/company/settings/members`; const approverLabel = invitedByUserName ?? "A company admin"; return ( @@ -181,15 +180,10 @@ function AwaitingJoinApprovalPanel({
- Ask them to visit Company Settings → Members to approve your request. + Ask them to visit Company Settings → Members to approve your request.
Refresh this page after you've been approved — you'll be redirected automatically.