🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(acceptance): mount Share on the main SPA detail page (#21266)
Neko085257a04301
diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.test.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.test.tsxnew file mode 100644index 00000000000..280befe3c54--- /dev/null+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.test.tsx@@ -0,0 +1,90 @@+import { cleanup, fireEvent, render, screen } from '@testing-library/react';+import { MemoryRouter } from 'react-router';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { AcceptanceOverview } from './AcceptanceOverview';++const bundle = vi.hoisted(() => ({ current: undefined as unknown }));++vi.mock('./AcceptanceScope', () => ({+ useAcceptanceScope: () => ({ acceptanceId: 'acc-1', embedded: false }),+}));+vi.mock('./useAcceptanceBundle', () => ({+ useAcceptanceBundle: () => ({ data: bundle.current, mutate: vi.fn() }),+}));+vi.mock('./useAcceptanceTurn', () => ({ useAcceptanceTurn: () => ({ turn: undefined }) }));+vi.mock('./turnChecks', () => ({ checksForTurn: () => [] }));+vi.mock('./Comments/hooks', () => ({+ useAcceptanceComments: () => ({ items: [], threads: [] }),+}));+vi.mock('./Comments/discussionTimeline', () => ({ countDiscussionMessages: () => 0 }));+vi.mock('@/services/verify', () => ({ verifyService: { setAcceptanceVisibility: vi.fn() } }));++// Everything else in the page is out of scope here: the test is about which+// header controls the main SPA mounts, not how the record's body renders.+vi.mock('./Checks/AcceptanceCheckInventory', () => ({ default: () => null }));+vi.mock('./Checks/AcceptanceCheckOwnerToolbar', () => ({ default: () => null }));+vi.mock('./Comments/AcceptanceDiscussion', () => ({ default: () => null }));+vi.mock('./Comments/ReviewerApprovalBar', () => ({ default: () => null }));+vi.mock('./Conversation/AcceptanceOriginTopic', () => ({ default: () => null }));+vi.mock('./Evidence/AcceptanceResources', () => ({ default: () => null }));+vi.mock('./Flow/AcceptanceFlow', () => ({ AcceptanceFlow: () => null }));+vi.mock('./Focus/AcceptanceEnterFocus', () => ({ default: () => null }));+vi.mock('./Gate/GateReview', () => ({ default: () => null }));+vi.mock('./Header/AcceptanceGoal', () => ({ default: () => null }));+vi.mock('./Header/AcceptanceGoalEdit', () => ({ default: () => null }));+vi.mock('./Header/AcceptanceIdentity', () => ({ default: () => <div>identity-stub</div> }));+vi.mock('./Header/AcceptanceStatusControl', () => ({ default: () => null }));+vi.mock('./Header/AcceptanceTabs', () => ({ default: () => null }));+vi.mock('./Review/AcceptanceDecision', () => ({ default: () => null }));++const buildBundle = (overrides: { canReview: boolean; visibility: 'private' | 'public' }) => ({+ acceptance: { id: 'acc-1', visibility: overrides.visibility },+ canReview: overrides.canReview,+ isOwner: overrides.canReview,+ rounds: [],+ subject: { id: 'subject-1', type: 'task' },+});++const renderOverview = () =>+ render(+ <MemoryRouter>+ <AcceptanceOverview />+ </MemoryRouter>,+ );++beforeEach(() => {+ bundle.current = undefined;+});++afterEach(cleanup);++describe('AcceptanceOverview sharing', () => {+ it('mounts the share control for a viewer who can manage the acceptance', async () => {+ bundle.current = buildBundle({ canReview: true, visibility: 'private' });+ renderOverview();++ const share = screen.getByRole('button', { name: /acceptance\.share\.title/ });+ fireEvent.click(share);++ expect(await screen.findByText('acceptance.share.makePublic')).toBeTruthy();+ expect(screen.getByText('report.actions.copyLink')).toBeTruthy();+ });++ it('offers to make a public acceptance private', async () => {+ bundle.current = buildBundle({ canReview: true, visibility: 'public' });+ renderOverview();++ fireEvent.click(screen.getByRole('button', { name: /acceptance\.share\.title/ }));++ expect(await screen.findByText('acceptance.share.makePrivate')).toBeTruthy();+ });++ it('shows no share control to a viewer who cannot manage the acceptance', () => {+ bundle.current = buildBundle({ canReview: false, visibility: 'public' });+ renderOverview();++ expect(screen.getByText('identity-stub')).toBeTruthy();+ expect(screen.queryByRole('button', { name: /acceptance\.share\.title/ })).toBeNull();+ });+});diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.tsxindex 305a92d4b86..1829106f3ba 100644--- a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx@@ -21,6 +21,7 @@ import GateReview from './Gate/GateReview';import AcceptanceGoal from './Header/AcceptanceGoal';import AcceptanceGoalEdit from './Header/AcceptanceGoalEdit';import AcceptanceIdentity from './Header/AcceptanceIdentity';+import AcceptanceShare from './Header/AcceptanceShare';import AcceptanceStatusControl from './Header/AcceptanceStatusControl';import type { AcceptanceTabKey } from './Header/AcceptanceTabs';import AcceptanceTabs from './Header/AcceptanceTabs';@@ -93,11 +94,19 @@ export const AcceptanceOverview = ({<><Flexbox className={styles.headerBand}><Flexbox className={styles.column} gap={12}>- <AcceptanceIdentity- focusSlot={<AcceptanceEnterFocus />}- statusSlot={<AcceptanceStatusControl />}- topicSlot={<AcceptanceOriginTopic />}- />+ {/* Sharing sits beside the identity, as on the workbench page. The+ control gates itself on the server's review capability, so a+ reader without it sees nothing here. */}+ <Flexbox horizontal align={'flex-start'} gap={16} justify={'space-between'}>+ <Flexbox flex={1} style={{ minWidth: 0 }}>+ <AcceptanceIdentity+ focusSlot={<AcceptanceEnterFocus />}+ statusSlot={<AcceptanceStatusControl />}+ topicSlot={<AcceptanceOriginTopic />}+ />+ </Flexbox>+ <AcceptanceShare />+ </Flexbox>{!gateDossier && <AcceptanceGoal editSlot={<AcceptanceGoalEdit />} />}{/* The requirement needs room to land before the tabs start a newthought — at the band's uniform gap it read as another row of