Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(calls): call record share menu for team access (#6536)

Will Hutchinsone353769f6ef1
diff --git a/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx b/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
index ac4eac90d9..03d636e6f0 100644
--- a/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
+++ b/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
@@ -13,6 +13,11 @@ const mocks = vi.hoisted(() => ({
getDocumentPermissions: vi.fn(),
getChatPermissions: vi.fn(),
updateChatPermissions: vi.fn(),
+ fetchCallSharePermission: vi.fn(),
+ updateCallTeamShare: vi.fn(),
+ setCallRecordTeamShareCache: vi.fn(),
+ callRecordShared: true,
+ callRecordQuerySuccess: true,
getProjectPermissions: vi.fn(),
copyLink: vi.fn(),
blockPermissionsRead: vi.fn(),
@@ -126,6 +131,35 @@ vi.mock('@service-cognition/client', () => ({
updateChatPermissions: mocks.updateChatPermissions,
},
}));
+vi.mock('@queries/call/call', () => ({
+ fetchCallSharePermission: (...args: unknown[]) =>
+ mocks.fetchCallSharePermission(...args),
+ updateCallTeamShare: (...args: unknown[]) =>
+ mocks.updateCallTeamShare(...args),
+ setCallRecordTeamShareCache: (...args: unknown[]) =>
+ mocks.setCallRecordTeamShareCache(...args),
+ sharePermissionFromCallRecord: (record: {
+ callId: string;
+ createdBy: string;
+ shareWithTeam: boolean;
+ }) => ({
+ id: record.callId,
+ owner: record.createdBy,
+ teamShareAccessLevel: record.shareWithTeam ? 'view' : null,
+ }),
+ useCallRecordQuery: () => ({
+ get isSuccess() {
+ return mocks.callRecordQuerySuccess;
+ },
+ get data() {
+ return {
+ callId: 'call-1',
+ createdBy: 'owner',
+ shareWithTeam: mocks.callRecordShared,
+ };
+ },
+ }),
+}));
vi.mock('@queries/team/teams', () => ({
useCurrentTeamQuery: () => ({
isSuccess: mocks.hasTeam,
@@ -216,7 +250,10 @@ beforeEach(() => {
mocks.inBlock = true;
mocks.mobile = false;
mocks.hasTeam = false;
+ mocks.callRecordShared = true;
+ mocks.callRecordQuerySuccess = true;
mocks.updateChatPermissions.mockResolvedValue({ isErr: () => false });
+ mocks.updateCallTeamShare.mockResolvedValue({ isErr: () => false });
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText: mocks.copyLink },
@@ -394,6 +431,116 @@ function mountChatShare() {
));
}
+function mountCallShare() {
+ mocks.blockPermissionsRead.mockReturnValue({
+ isErr: () => false,
+ value: {
+ id: 'perm-call',
+ owner: 'owner',
+ linkShare: null,
+ linkShareAccessLevel: null,
+ teamShareAccessLevel: 'view',
+ channelSharePermissions: [],
+ },
+ });
+ render(() => (
+ <ShareModal
+ id="call-1"
+ name="Weekly sync"
+ owner="owner"
+ itemType="call"
+ blockAlias="call"
+ userPermissions={Permissions.OWNER}
+ isSharePermOpen
+ setIsSharePermOpen={vi.fn()}
+ />
+ ));
+}
+
+describe('call team sharing', () => {
+ it('lets the owner share the call with their team at view', async () => {
+ mocks.hasTeam = true;
+ mountCallShare();
+
+ expect(screen.getByText('Team access')).toBeTruthy();
+ expect(
+ screen.getByText("Share this call directly with the owner's team.")
+ ).toBeTruthy();
+ expect(
+ screen
+ .getByRole('group', { name: 'Team access level' })
+ .getAttribute('data-value')
+ ).toBe('view');
+
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Set Team access level view' })
+ );
+
+ await vi.waitFor(() =>
+ expect(mocks.updateCallTeamShare).toHaveBeenCalledWith('call-1', true)
+ );
+ expect(mocks.setCallRecordTeamShareCache).toHaveBeenCalledWith(
+ 'call-1',
+ true
+ );
+ expect(mocks.updateChatPermissions).not.toHaveBeenCalled();
+ expect(mocks.getDocumentPermissions).not.toHaveBeenCalled();
+ });
+
+ it('clears call team access with an explicit null', async () => {
+ mocks.hasTeam = true;
+ mountCallShare();
+
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Set Team access level NONE' })
+ );
+
+ await vi.waitFor(() =>
+ expect(mocks.updateCallTeamShare).toHaveBeenCalledWith('call-1', false)
+ );
+ expect(mocks.setCallRecordTeamShareCache).toHaveBeenCalledWith(
+ 'call-1',
+ false
+ );
+ });
+
+ it('shows team access from the call record cache after the checkbox writes it', () => {
+ mocks.hasTeam = true;
+ mocks.callRecordShared = false;
+ mountCallShare();
+
+ expect(
+ screen
+ .getByRole('group', { name: 'Team access level' })
+ .getAttribute('data-value')
+ ).toBe('NONE');
+ });
+
+ it('hides call team access when the owner has no team', () => {
+ mocks.hasTeam = false;
+ mountCallShare();
+
+ expect(screen.queryByText('Team access')).toBeNull();
+ expect(
+ screen.queryByRole('group', { name: 'Team access level' })
+ ).toBeNull();
+ expect(mocks.updateCallTeamShare).not.toHaveBeenCalled();
+ });
+
+ it('loads team access from the call record outside a block', () => {
+ mocks.inBlock = false;
+ mocks.hasTeam = true;
+ mountCallShare();
+
+ expect(
+ screen
+ .getByRole('group', { name: 'Team access level' })
+ .getAttribute('data-value')
+ ).toBe('view');
+ expect(mocks.fetchCallSharePermission).not.toHaveBeenCalled();
+ });
+});
+
describe('chat team sharing', () => {
it('lets the owner share the chat with their team through the chat permissions endpoint', async () => {
mocks.hasTeam = true;
diff --git a/apps/web/src/lib/core/component/TopBar/ShareButton.tsx b/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
index 619715a93b..d0d459fd6d 100644
--- a/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
+++ b/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
@@ -48,6 +48,12 @@ import IconShared from '@phosphor/share.svg';
import UserCircle from '@phosphor/user-circle.svg';
import UsersIcon from '@phosphor/users.svg';
import IconX from '@phosphor/x.svg';
+import {
+ setCallRecordTeamShareCache,
+ sharePermissionFromCallRecord,
+ updateCallTeamShare,
+ useCallRecordQuery,
+} from '@queries/call/call';
import { useCurrentTeamQuery } from '@queries/team/teams';
import { cognitionApiServiceClient } from '@service-cognition/client';
import {
@@ -109,6 +115,7 @@ import {
TEAM_SHARE_SCOPE_OPTIONS,
type TeamSharePayload,
type TeamShareScope,
+ teamShareScopeOptionsForItem,
} from './linkShare';
false && clickOutside;
@@ -118,6 +125,21 @@ const isLinkSharingDisabledForItem = (itemType: ItemType): boolean =>
itemType === 'project' ||
itemType === 'agent_session';
+async function fetchSharePermissions(id: string, itemType: ItemType) {
+ if (itemType === 'chat') {
+ return cognitionApiServiceClient.getChatPermissions({ id });
+ }
+ if (itemType === 'document') {
+ return storageServiceClient.getDocumentPermissions({ document_id: id });
+ }
+ if (itemType === 'project') {
+ if (id === 'trash') {
+ return;
+ }
+ return storageServiceClient.projects.getPermissions({ id });
+ }
+}
+
const agentSessionShareDescription = (canShare: boolean) =>
canShare
? 'Recipients can view and control this agent session.'
@@ -149,16 +171,7 @@ const permissionsBlockResource = createBlockResource(
const id = useBlockId();
const blockName = useBlockName();
const itemType = blockNameToItemType(blockName);
- if (itemType === 'chat') {
- return cognitionApiServiceClient.getChatPermissions({ id });
- } else if (itemType === 'document') {
- return storageServiceClient.getDocumentPermissions({ document_id: id });
- } else if (itemType === 'project') {
- if (id === 'trash') {
- return;
- }
- return storageServiceClient.projects.getPermissions({ id });
- }
+ return fetchSharePermissions(id, itemType);
},
{ initialValue: undefined }
);
@@ -301,6 +314,7 @@ interface TeamShareControls {
setAccessLevel: (scope: TeamShareScope) => void;
/** Noun for the copy, e.g. "document" or "chat". */
itemNoun: string;
+ scopeOptions: ReadonlyArray<{ value: TeamShareScope; label: string }>;
}
function LinkSharingControls(props: LinkSharingControlsProps) {
@@ -381,7 +395,11 @@ function LinkSharingControls(props: LinkSharingControlsProps) {
props.teamShare?.setAccessLevel(value as TeamShareScope)
}
>
- <For each={TEAM_SHARE_SCOPE_OPTIONS}>
+ <For
+ each={
+ props.teamShare?.scopeOptions ?? TEAM_SHARE_SCOPE_OPTIONS
+ }
+ >
{(option) => (
<Dropdown.RadioItem value={option.value}>
<span class="flex-1 truncate">{option.label}</span>
@@ -651,6 +669,9 @@ function MobileShareDrawer(props: MobileShareDrawerProps) {
accessLevel: props.teamShareAccessLevel,
setAccessLevel: props.setTeamShareAccessLevel,
itemNoun: getShareItemNoun(props.itemType),
+ scopeOptions: teamShareScopeOptionsForItem(
+ props.itemType
+ ),
}
: undefined
}
@@ -666,6 +687,9 @@ export function ShareModal(props: ShareModalProps) {
const navigate = useNavigate();
const analytics = useAnalytics();
const currentTeamQuery = useCurrentTeamQuery();
+ const callRecordQuery = useCallRecordQuery(() =>
+ props.itemType === 'call' ? props.id : ''
+ );
const isBlockContext = isInBlock() && props.itemType !== 'agent_session';
const [fallbackPermissionsResource, { refetch: refetchFallback }] =
createResource(
@@ -676,18 +700,7 @@ export function ShareModal(props: ShareModalProps) {
async (source) => {
if (!source) return;
const { id, itemType } = source;
- if (itemType === 'chat') {
- return cognitionApiServiceClient.getChatPermissions({ id });
- } else if (itemType === 'document') {
- return storageServiceClient.getDocumentPermissions({
- document_id: id,
- });
- } else if (itemType === 'project') {
- if (id === 'trash') {
- return;
- }
- return storageServiceClient.projects.getPermissions({ id });
- }
+ return fetchSharePermissions(id, itemType);
},
{ initialValue: undefined }
);
@@ -963,6 +976,12 @@ export function ShareModal(props: ShareModalProps) {
});
const teamShareAccessLevel = createMemo(() => {
+ if (props.itemType === 'call') {
+ if (!callRecordQuery.isSuccess) return;
+ const record = callRecordQuery.data;
+ if (!record) return;
+ return sharePermissionFromCallRecord(record).teamShareAccessLevel;
+ }
const currentPermissions = permissionsResource.latest;
if (!currentPermissions || currentPermissions.isErr()) return;
@@ -975,19 +994,23 @@ export function ShareModal(props: ShareModalProps) {
return;
}
const itemNoun = getShareItemNoun(props.itemType);
+ const shared =
+ getTeamShareScope(sharePermission.teamShareAccessLevel) !== 'NONE';
- // Both endpoints accept the same `sharePermission.teamShareAccessLevel`
- // patch; the backend authorizes it against the persisted owner.
- const result =
- props.itemType === 'chat'
- ? await cognitionApiServiceClient.updateChatPermissions({
- sharePermission,
- chat_id: props.id,
- })
- : await storageServiceClient.editDocument({
- sharePermission,
- documentId: props.id,
- });
+ let result: Result<unknown, ResultError<any>[]>;
+ if (props.itemType === 'chat') {
+ result = await cognitionApiServiceClient.updateChatPermissions({
+ sharePermission,
+ chat_id: props.id,
+ });
+ } else if (props.itemType === 'call') {
+ result = await updateCallTeamShare(props.id, shared);
+ } else {
+ result = await storageServiceClient.editDocument({
+ sharePermission,
+ documentId: props.id,
+ });
+ }
if (result.isErr()) {
toast.alert('Failed to change team access', {
subtext: 'Please try again',
@@ -998,6 +1021,9 @@ export function ShareModal(props: ShareModalProps) {
refetch();
const scope = getTeamShareScope(sharePermission.teamShareAccessLevel);
+ if (props.itemType === 'call') {
+ setCallRecordTeamShareCache(props.id, shared);
+ }
if (scope === 'NONE') {
toast.success(`Removed team access for this ${itemNoun}`);
return;
@@ -1028,6 +1054,7 @@ export function ShareModal(props: ShareModalProps) {
accessLevel: teamShareAccessLevel(),
setAccessLevel: setTeamShareAccessLevel,
itemNoun: getShareItemNoun(props.itemType),
+ scopeOptions: teamShareScopeOptionsForItem(props.itemType),
}
: undefined;
diff --git a/apps/web/src/lib/core/component/TopBar/linkShare.test.ts b/apps/web/src/lib/core/component/TopBar/linkShare.test.ts
index 068f2088f5..740d7ef0ef 100644
--- a/apps/web/src/lib/core/component/TopBar/linkShare.test.ts
+++ b/apps/web/src/lib/core/component/TopBar/linkShare.test.ts
@@ -11,14 +11,15 @@ import {
isTeamShareSupportedForItem,
LINK_SHARE_SCOPE_OPTIONS,
TEAM_SHARE_SCOPE_OPTIONS,
+ teamShareScopeOptionsForItem,
} from './linkShare';
describe('isTeamShareSupportedForItem', () => {
- it.each(['document', 'chat'] as const)('supports %s', (itemType) => {
+ it.each(['document', 'chat', 'call'] as const)('supports %s', (itemType) => {
expect(isTeamShareSupportedForItem(itemType)).toBe(true);
});
- it.each(['project', 'email', 'agent_session', 'call'] as const)(
+ it.each(['project', 'email', 'agent_session'] as const)(
'does not offer team access for %s',
(itemType) => {
expect(isTeamShareSupportedForItem(itemType)).toBe(false);
@@ -30,6 +31,7 @@ describe('getShareItemNoun', () => {
it.each([
['document', 'document'],
['chat', 'chat'],
+ ['call', 'call'],
['email', 'email thread'],
['agent_session', 'agent session'],
] as const)('names %s as "%s"', (itemType, noun) => {
@@ -127,6 +129,19 @@ describe('team share payload', () => {
]);
});
+ it('limits calls to None and View', () => {
+ expect(teamShareScopeOptionsForItem('call')).toEqual([
+ { value: 'NONE', label: 'None' },
+ { value: 'view', label: 'View' },
+ ]);
+ expect(teamShareScopeOptionsForItem('document')).toEqual([
+ { value: 'NONE', label: 'None' },
+ { value: 'view', label: 'View' },
+ { value: 'comment', label: 'Comment' },
+ { value: 'edit', label: 'Edit' },
+ ]);
+ });
+
it.each([undefined, null, 'owner'] as const)(
'treats %s as no explicit team share',
(level) => {
diff --git a/apps/web/src/lib/core/component/TopBar/linkShare.ts b/apps/web/src/lib/core/component/TopBar/linkShare.ts
index 8aa467f810..f592608b1e 100644
--- a/apps/web/src/lib/core/component/TopBar/linkShare.ts
+++ b/apps/web/src/lib/core/component/TopBar/linkShare.ts
@@ -5,13 +5,10 @@ import type { UpdateSharePermissionRequestV2 } from '@service-storage/generated/
export const NO_LINK_SHARE = 'NONE' as const;
-/**
- * Entity types whose backend honors `sharePermission.teamShareAccessLevel`
- * (documents via `PATCH /documents/{id}`, AI chats via `PATCH /chats/{id}`).
- */
const TEAM_SHAREABLE_ITEM_TYPES: ReadonlySet<ItemType> = new Set<ItemType>([
'document',
'chat',
+ 'call',
]);
export function isTeamShareSupportedForItem(itemType: ItemType): boolean {
@@ -42,6 +39,8 @@ export type TeamShareLevel = Exclude<AccessLevel, 'owner'>;
export type TeamShareScope = TeamShareLevel | typeof NO_TEAM_SHARE;
+export type CallTeamShareScope = typeof NO_TEAM_SHARE | 'view';
+
export type TeamSharePayload = Required<
Pick<UpdateSharePermissionRequestV2, 'teamShareAccessLevel'>
>;
@@ -98,6 +97,19 @@ export const TEAM_SHARE_SCOPE_OPTIONS = (
label: TEAM_SHARE_COPY[scope],
}));
+export const CALL_TEAM_SHARE_SCOPE_OPTIONS = (
+ ['NONE', 'view'] as const satisfies readonly CallTeamShareScope[]
+).map((scope) => ({
+ value: scope,
+ label: TEAM_SHARE_COPY[scope],
+}));
+
+export function teamShareScopeOptionsForItem(itemType: ItemType) {
+ return itemType === 'call'
+ ? CALL_TEAM_SHARE_SCOPE_OPTIONS
+ : TEAM_SHARE_SCOPE_OPTIONS;
+}
+
export function getLinkShareScope(
linkShare: LinkShare | null | undefined
): LinkShareScope {
diff --git a/apps/web/src/lib/queries/call/call.test.ts b/apps/web/src/lib/queries/call/call.test.ts
index 27e306e5be..f8137dd846 100644
--- a/apps/web/src/lib/queries/call/call.test.ts
+++ b/apps/web/src/lib/queries/call/call.test.ts
@@ -5,11 +5,20 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
// `call.ts` reads the app-wide query client and service client at module
// load; swap in an isolated client and stubs so the tests exercise only the
// cache-writer logic.
+const callClient = vi.hoisted(() => ({
+ getCallRecord: vi.fn(),
+ editCallRecord: vi.fn(),
+}));
vi.mock('@queries/client', async () => {
const { QueryClient } = await import('@tanstack/solid-query');
return { queryClient: new QueryClient() };
});
-vi.mock('@service-call/client', () => ({ callServiceClient: {} }));
+vi.mock('@service-call/client', () => ({
+ callServiceClient: {
+ getCallRecord: (...args: unknown[]) => callClient.getCallRecord(...args),
+ editCallRecord: (...args: unknown[]) => callClient.editCallRecord(...args),
+ },
+}));
vi.mock('@core/component/Toast/Toast', () => ({
toast: { alert: vi.fn(), failure: vi.fn(), success: vi.fn() },
}));
@@ -19,10 +28,13 @@ import { queryClient } from '@queries/client';
import type { CallRecord } from '@service-storage/generated/schemas/callRecord';
import {
buildCallTeamSharePayload,
+ fetchCallSharePermission,
isCallSharedWithTeam,
setActiveCallEndedCache,
setActiveCallStartedCache,
setCallRecordTeamShareCache,
+ sharePermissionFromCallRecord,
+ updateCallTeamShare,
} from './call';
import { callKeys } from './keys';
@@ -110,6 +122,8 @@ const record = (over: Partial<CallRecord>): CallRecord => ({
describe('call team sharing helpers', () => {
beforeEach(() => {
queryClient.clear();
+ callClient.getCallRecord.mockReset();
+ callClient.editCallRecord.mockReset();
});
it('buildCallTeamSharePayload maps the checkbox to view or an explicit clear', () => {
@@ -122,6 +136,79 @@ describe('call team sharing helpers', () => {
});
});
+ it('sharePermissionFromCallRecord maps the team toggle to view or null', () => {
+ expect(
+ sharePermissionFromCallRecord(
+ record({
+ callId: 'call-live',
+ createdBy: 'macro|[email protected]',
+ isActive: true,
+ shareWithTeam: true,
+ teamShareAccessLevel: null,
+ })
+ )
+ ).toEqual({
+ id: 'call-live',
+ owner: 'macro|[email protected]',
+ teamShareAccessLevel: 'view',
+ });
+ expect(
+ sharePermissionFromCallRecord(
+ record({
+ shareWithTeam: false,
+ teamShareAccessLevel: null,
+ })
+ )
+ ).toEqual({
+ id: 'call-1',
+ owner: 'macro|[email protected]',
+ teamShareAccessLevel: null,
+ });
+ });
+
+ it('fetchCallSharePermission maps a live shared call to view', async () => {
+ const { ok } = await import('neverthrow');
+ callClient.getCallRecord.mockResolvedValue(
+ ok(
+ record({
+ callId: 'call-live',
+ createdBy: 'macro|[email protected]',
+ isActive: true,
+ shareWithTeam: true,
+ teamShareAccessLevel: null,
+ })
+ )
+ );
+
+ const result = await fetchCallSharePermission('call-live');
+
+ expect(callClient.getCallRecord).toHaveBeenCalledWith('call-live');
+ expect(result.isOk()).toBe(true);
+ if (result.isOk()) {
+ expect(result.value).toEqual({
+ id: 'call-live',
+ owner: 'macro|[email protected]',
+ teamShareAccessLevel: 'view',
+ });
+ }
+ });
+
+ it('updateCallTeamShare patches view or an explicit null', async () => {
+ callClient.editCallRecord.mockResolvedValue({ isErr: () => false });
+
+ await updateCallTeamShare('call-1', true);
+ expect(callClient.editCallRecord).toHaveBeenCalledWith({
+ callId: 'call-1',
+ sharePermission: { teamShareAccessLevel: 'view' },
+ });
+
+ await updateCallTeamShare('call-1', false);
+ expect(callClient.editCallRecord).toHaveBeenCalledWith({
+ callId: 'call-1',
+ sharePermission: { teamShareAccessLevel: null },
+ });
+ });
+
it('isCallSharedWithTeam covers the live toggle and the archived canonical grant', () => {
// Live: the pending toggle, no canonical level yet.
expect(
diff --git a/apps/web/src/lib/queries/call/call.ts b/apps/web/src/lib/queries/call/call.ts
index 8759a121e7..39d78645ea 100644
--- a/apps/web/src/lib/queries/call/call.ts
+++ b/apps/web/src/lib/queries/call/call.ts
@@ -5,6 +5,7 @@ import { queryClient } from '@queries/client';
import { type CallRecord, callServiceClient } from '@service-call/client';
import type { ActiveCallSummary } from '@service-storage/generated/schemas/activeCallSummary';
import type { CallActiveResponse } from '@service-storage/generated/schemas/callActiveResponse';
+import type { SharePermissionV2 } from '@service-storage/generated/schemas/sharePermissionV2';
import type { UpdateSharePermissionRequestV2 } from '@service-storage/generated/schemas/updateSharePermissionRequestV2';
import { useMutation, useQuery } from '@tanstack/solid-query';
import type { Accessor } from 'solid-js';
@@ -170,6 +171,22 @@ export function isCallSharedWithTeam(record: CallRecord): boolean {
return record.shareWithTeam;
}
+export function sharePermissionFromCallRecord(
+ record: CallRecord
+): SharePermissionV2 {
+ return {
+ id: record.callId,
+ owner: record.createdBy,
+ teamShareAccessLevel: isCallSharedWithTeam(record) ? 'view' : null,
+ };
+}
+
+export function fetchCallSharePermission(callId: string) {
+ return callServiceClient
+ .getCallRecord(callId)
+ .then((result) => result.map(sharePermissionFromCallRecord));
+}
+
/** The `sharePermission` patch that shares a call with the team, or revokes it. */
export function buildCallTeamSharePayload(
shared: boolean
@@ -177,6 +194,13 @@ export function buildCallTeamSharePayload(
return { teamShareAccessLevel: shared ? 'view' : null };
}
+export function updateCallTeamShare(callId: string, shared: boolean) {
+ return callServiceClient.editCallRecord({
+ callId,
+ sharePermission: buildCallTeamSharePayload(shared),
+ });
+}
+
function patchCachedCallTeamShare(
record: CallRecord,
shared: boolean
@@ -231,12 +255,7 @@ export function useSetCallRecordTeamShareMutation() {
return useMutation(() => ({
gcTime: 0,
mutationFn: async (params: { callId: string; shared: boolean }) => {
- await throwOnErr(() =>
- callServiceClient.editCallRecord({
- callId: params.callId,
- sharePermission: buildCallTeamSharePayload(params.shared),
- })
- );
+ await throwOnErr(() => updateCallTeamShare(params.callId, params.shared));
return params;
},
onSuccess({ callId, shared }) {
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index e2136ea789..31cbdb1813 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -500,9 +500,10 @@ On phones, recorded call headers omit the **Call Again** action.
### Sharing a call
-A call's side panel has a `Sharing` section with one `Share with team` checkbox, and the in-call
-controls carry the same checkbox while a call is live. It is canonical team sharing (the same
-`Team access` model documents and AI chats use), fixed at **view**. While the call is **live**
+A call's **Share** dialog has a `Team access` control (None or View) for the same canonical
+team share. The side panel has a `Sharing` section with one `Share with team` checkbox, and the
+in-call controls carry the same checkbox while a call is live. It is canonical team sharing (the
+same `Team access` model documents and AI chats use), fixed at **view**. While the call is **live**
the checkbox is a pending toggle (on by default) that any participant with edit access can flip;
other participants see it update live. When the call ends it is applied: with the toggle on,
everyone on the creator's team can open the recorded call, read the transcript and AI summary,