Drop the owner-account warning box when sharing a tool

A tool that can act already asks the owner to confirm; one that only reads
names whose account members use in a plain line.
This commit is contained in:
arc53-machine committed 2026-09-29 13:13:27 +01:00
1 parent 56ababae71
commit 85175fa8c1
2 files changed
+18 -13

No files matched your search

+11 -1
View File
@@ -99,8 +99,9 @@ describe('ShareToTeamModal credentials', () => {
);
});
it('warns that members act as the owner in owner mode', async () => {
it('says whose account members use on a tool that only reads', async () => {
await render(credentials());
expect(document.body.querySelector('[role="note"]')).toBeNull();
expect(document.body.querySelector('[data-slot="option-card"]')).toBeNull();
expect(toggle('owner').getAttribute('aria-checked')).toBe('true');
expect(document.body.textContent).toContain(
@@ -108,6 +109,15 @@ describe('ShareToTeamModal credentials', () => {
);
});
it('asks only for the confirmation on a tool that can act, with no warning box', async () => {
await render(credentials({ hasWrites: true }));
expect(document.body.querySelector('[role="note"]')).toBeNull();
expect(document.body.textContent).not.toContain(
'settings.connectors.share.ownerWarning',
);
expect(document.body.querySelector('#share-confirm-writes')).not.toBeNull();
});
it('blocks sharing an owner-mode tool with writes until confirmed', async () => {
await render(credentials({ hasWrites: true }));
expect(picker().disabled).toBe(true);
+7 -12
View File
@@ -1,10 +1,4 @@
import {
CircleAlert,
Trash2,
TriangleAlert,
UserRound,
UsersRound,
} from 'lucide-react';
import { CircleAlert, Trash2, UserRound, UsersRound } from 'lucide-react';
import { useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
@@ -593,16 +587,17 @@ export default function ShareToTeamModal({
</p>
)}
{credentialMode === 'owner' ? (
<Alert variant="warning" role="note">
<TriangleAlert aria-hidden="true" />
<AlertDescription>
// A tool that can act asks for the confirmation below, which
// says the same; one that only reads gets a plain line.
needsWriteConfirm ? null : (
<p className="text-muted-foreground text-sm">
{t('settings.connectors.share.ownerWarning', {
account: credentials.account,
name: credentials.connectorName,
interpolation: { escapeValue: false },
})}
</AlertDescription>
</Alert>
</p>
)
) : (
<p className="text-muted-foreground text-sm">
{t('settings.connectors.share.memberNote', {