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.

fix(share): title the roster Owner when only the owner is listed (#7730)

Peter Chinmanaccf06220a50
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 21b1ddc664..2c46b4c282 100644
--- a/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
+++ b/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
@@ -660,6 +660,50 @@ describe('agent session sharing', () => {
expect(mocks.updateAgentPermissions).not.toHaveBeenCalled();
}
);
+ it.each([false, true])(
+ 'titles the roster for the owner when a participant sees no other grants (mobile: %s)',
+ (mobile) => {
+ mocks.mobile = mobile;
+ mountShare(false);
+ if (mobile) {
+ expect(screen.getByRole('tab', { name: 'Owner' })).toBeTruthy();
+ expect(screen.queryByRole('tab', { name: 'People' })).toBeNull();
+ } else {
+ expect(screen.getAllByText('Owner').length).toBeGreaterThan(0);
+ expect(
+ screen.queryByText('People with access to this agent session')
+ ).toBeNull();
+ }
+ }
+ );
+
+ it.each([false, true])(
+ 'keeps the audience title when a participant sees other grants (mobile: %s)',
+ async (mobile) => {
+ mocks.mobile = mobile;
+ mocks.getAgentPermissions.mockResolvedValue(
+ ok({
+ id: 'session-permissions',
+ owner: SOMEONE_ELSE,
+ channelSharePermissions: [
+ { channel_id: 'shared-channel', access_level: 'view' },
+ ],
+ })
+ );
+ mountShare(false);
+ if (mobile)
+ await vi.waitFor(() =>
+ expect(screen.getByRole('tab', { name: 'People' })).toBeTruthy()
+ );
+ else
+ await vi.waitFor(() =>
+ expect(
+ screen.getByText('People with access to this agent session')
+ ).toBeTruthy()
+ );
+ }
+ );
+
it('cancels an owner draft without sharing', () => {
const { onOpenChange } = mountShare(true);
selectChannel();
diff --git a/apps/web/src/lib/core/component/TopBar/ShareButton.tsx b/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
index 0d3c20ea9a..947e333513 100644
--- a/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
+++ b/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
@@ -513,6 +513,8 @@ function LinkSharingControls(props: LinkSharingControlsProps) {
interface MobileShareDrawerProps {
editPermissionEnabled?: boolean;
canForward: boolean;
+ /** The roster lists only the owner, so it is titled for them alone. */
+ ownerOnlyRoster: boolean;
isOpen: boolean;
setIsOpen: (value: boolean) => void;
blockAlias: ShareBlockType;
@@ -551,7 +553,10 @@ function MobileShareDrawer(props: MobileShareDrawerProps) {
const mobileTabs = createMemo((): TabItem[] => {
const tabs: TabItem[] = [{ value: 'share', label: 'Share' }];
if ((props.recipients?.length ?? 0) > 0 || props.owner)
- tabs.push({ value: 'people', label: 'People' });
+ tabs.push({
+ value: 'people',
+ label: props.ownerOnlyRoster ? 'Owner' : 'People',
+ });
if (
props.linkSharing ||
(props.userPermissions === Permissions.OWNER &&
@@ -899,6 +904,14 @@ export function ShareModal(props: ShareModalProps) {
return sharePermission.channelSharePermissions;
});
+ // A viewer who does not own the item cannot read its other grants, so the
+ // roster is just the owner and must not be titled as the full audience.
+ const ownerOnlyRoster = () =>
+ !!props.owner &&
+ props.owner !== userId() &&
+ (recipients()?.length ?? 0) === 0 &&
+ !props.hasDirectShares;
+
// Function to navigate to a channel
const navigateToChannel = createCallback((channelId: string) => {
navigate(`/channel/${channelId}`);
@@ -1373,6 +1386,7 @@ export function ShareModal(props: ShareModalProps) {
<MobileShareDrawer
editPermissionEnabled={editPermissionEnabled()}
canForward={canForward()}
+ ownerOnlyRoster={ownerOnlyRoster()}
isOpen={props.open}
setIsOpen={props.onOpenChange}
blockAlias={props.blockAlias}
@@ -1467,8 +1481,10 @@ export function ShareModal(props: ShareModalProps) {
<Panel depth={2} class="rounded-xl bg-dialog">
<Panel.Header class="px-4">
<span class="text-sm font-medium">
- People with access to this{' '}
- {getShareItemNoun(props.itemType)}
+ <Show when={!ownerOnlyRoster()} fallback="Owner">
+ People with access to this{' '}
+ {getShareItemNoun(props.itemType)}
+ </Show>
</span>
</Panel.Header>
<Panel.Body class="text-ink">
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 72510eaf94..22db7b0fad 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -1034,10 +1034,13 @@ select people or channels, choose their access level, and send the session with
an optional message using the same Share dialog and mobile drawer as tasks.
Sessions also support **Share** from entity list menus and the entity sharing
shortcut. **People with access** lists the owner and shared conversations;
-the owner can change or remove a conversation's access. **Link sharing** offers
+the owner can change or remove a conversation's access. When that list holds
+nobody but the owner — what a participant who cannot read the other grants
+sees — the section is titled **Owner** instead. **Link sharing** offers
None / Public / Team and an access level. **Team access** shares directly with
the owner's team when one exists. On mobile these controls are in the Share,
-People, and Link tabs. View and Comment allow reading; Edit also allows
+People, and Link tabs, and the People tab is likewise named Owner when only the
+owner is listed. View and Comment allow reading; Edit also allows
controlling the session. View-only sessions keep the composer, model selector,
and queued-message controls disabled. **Copy Share Link** remains in the header. Cancel
closes the composer without sending.