From aadbb7c498c2a624ae7c0811201f16b5085bc759 Mon Sep 17 00:00:00 2001 From: Bernhard Wittmann Date: Fri, 16 Oct 2026 09:38:51 +0000 Subject: [PATCH] fix(editor): Let the Assistant chat finish the Microsoft Teams setup (no-changelog) (#41188) --- .../__tests__/teams-cleanup.service.test.ts | 2 +- .../platforms/teams/teams-cleanup.service.ts | 5 +- .../components/N8nIcon/custom/microsoft.svg | 1 + .../src/components/N8nIcon/icons.ts | 2 + .../frontend/@n8n/i18n/src/locales/en.json | 14 +- .../agents/__tests__/AgentModal.test.ts | 13 ++ .../__tests__/utils/ActionDropdownTestStub.ts | 2 +- .../channels/AgentChannelStandardEditView.vue | 7 +- .../features/agents/channels/registry.test.ts | 21 ++ .../src/features/agents/channels/registry.ts | 37 ++-- .../AgentChannelTeamsAvailability.test.ts | 5 +- .../teams/AgentChannelTeamsAvailability.vue | 4 +- .../teams/AgentChannelTeamsIdentityCard.vue | 4 +- .../teams/AgentChannelTeamsManagedApp.test.ts | 2 +- .../teams/AgentChannelTeamsManagedApp.vue | 4 +- .../AgentChannelTeamsManagedSetup.test.ts | 28 ++- .../teams/AgentChannelTeamsManagedSetup.vue | 189 ++++++++++-------- .../teams/AgentChannelTeamsOptionLabel.vue | 8 +- .../teams/AgentChannelTeamsSetup.test.ts | 73 ++++--- .../channels/teams/AgentChannelTeamsSetup.vue | 111 +++++++--- .../teams/AgentChannelTeamsSetupView.vue | 1 - .../src/features/agents/channels/types.ts | 2 + .../AgentChannelApprovalSetting.vue | 2 +- .../AgentIntegrationCredentialConnection.vue | 4 +- .../components/InstanceAiConversation.vue | 5 +- .../components/ChannelSetupCard.test.ts | 133 ++++++++++++ .../ai/shared/components/ChannelSetupCard.vue | 41 +++- 27 files changed, 539 insertions(+), 181 deletions(-) create mode 100644 packages/frontend/@n8n/design-system/src/components/N8nIcon/custom/microsoft.svg diff --git a/packages/cli/src/modules/agents/integrations/platforms/teams/__tests__/teams-cleanup.service.test.ts b/packages/cli/src/modules/agents/integrations/platforms/teams/__tests__/teams-cleanup.service.test.ts index b2bc75e8e7a..9eee66a8b9b 100644 --- a/packages/cli/src/modules/agents/integrations/platforms/teams/__tests__/teams-cleanup.service.test.ts +++ b/packages/cli/src/modules/agents/integrations/platforms/teams/__tests__/teams-cleanup.service.test.ts @@ -24,7 +24,7 @@ describe('TeamsCleanupService', () => { await expect(service.describeLeftovers(ctx)).resolves.toEqual({ integrationType: 'teams', code: 'resources_not_deleted', - action: { type: 'open_url', url: expect.stringContaining('entra.microsoft.com') }, + action: { type: 'open_url', url: expect.stringContaining('admin.teams.microsoft.com') }, details: { appId: 'app-1' }, }); }); diff --git a/packages/cli/src/modules/agents/integrations/platforms/teams/teams-cleanup.service.ts b/packages/cli/src/modules/agents/integrations/platforms/teams/teams-cleanup.service.ts index 84e0fdc6aa1..7f51ac95282 100644 --- a/packages/cli/src/modules/agents/integrations/platforms/teams/teams-cleanup.service.ts +++ b/packages/cli/src/modules/agents/integrations/platforms/teams/teams-cleanup.service.ts @@ -6,8 +6,7 @@ import { AgentCredentialLookupService } from '../../agent-credential-lookup.serv import { stringProperty } from '../../integration-helpers'; const BOT_CREDENTIAL_TYPE = 'microsoftEntraServicePrincipalApi'; -const ENTRA_APPS_URL = - 'https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade'; +const TEAMS_MANAGE_APPS_URL = 'https://admin.teams.microsoft.com/policies/manage-apps'; export interface TeamsCleanupContext { user: User; @@ -48,7 +47,7 @@ export class TeamsCleanupService { return { integrationType: 'teams', code: 'resources_not_deleted', - action: { type: 'open_url', url: ENTRA_APPS_URL }, + action: { type: 'open_url', url: TEAMS_MANAGE_APPS_URL }, details: { appId: stringProperty(data, 'clientId') ?? '', }, diff --git a/packages/frontend/@n8n/design-system/src/components/N8nIcon/custom/microsoft.svg b/packages/frontend/@n8n/design-system/src/components/N8nIcon/custom/microsoft.svg new file mode 100644 index 00000000000..aaeed8f53f1 --- /dev/null +++ b/packages/frontend/@n8n/design-system/src/components/N8nIcon/custom/microsoft.svg @@ -0,0 +1 @@ + diff --git a/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts b/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts index 9390c69965d..354de795242 100644 --- a/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts +++ b/packages/frontend/@n8n/design-system/src/components/N8nIcon/icons.ts @@ -17,6 +17,7 @@ import GripLinesVertical from './custom/grip-lines-vertical.svg'; import Linear from './custom/linear.svg'; import Lovable from './custom/lovable.svg'; import Mcp from './custom/mcp.svg'; +import Microsoft from './custom/microsoft.svg'; import NodeDirty from './custom/node-dirty.svg'; import NodeEllipsis from './custom/brand/dots-horizontal--solid-16.svg'; import NodeExecutionError from './custom/node-execution-error.svg'; @@ -575,6 +576,7 @@ export const updatedIconSet = { teams: Teams, azure: Azure, entra: Entra, + microsoft: Microsoft, spinner: Spinner, 'node-dirty': NodeDirty, 'node-ellipsis': NodeEllipsis, diff --git a/packages/frontend/@n8n/i18n/src/locales/en.json b/packages/frontend/@n8n/i18n/src/locales/en.json index c741272ad0c..aa8e9ba4591 100644 --- a/packages/frontend/@n8n/i18n/src/locales/en.json +++ b/packages/frontend/@n8n/i18n/src/locales/en.json @@ -9408,6 +9408,7 @@ "agents.channels.teams.setup.availability.fileAccessPermission": "To read files that people attach in channels and group chats, the app needs the Microsoft Graph permission Files.Read.All. An administrator adds it under API permissions › Microsoft Graph › Application permissions, then selects Grant admin consent. Do not use Delegated permissions: the agent cannot use them. Send this link to an administrator if you are not one. After approval, it can take up to an hour to apply. Direct messages and pasted images work without it.", "agents.channels.teams.setup.availability.fileAccessApproved": "File access approved.", "agents.channels.teams.setup.availability.fileAccessNotApproved": "The agent can’t read files in channels and group chats until an admin approves.", + "agents.channels.teams.setup.availability.fileAccessNotApprovedOwnApp": "The agent can’t read files in channels and group chats until an admin grants the Files.Read.All application permission.", "agents.channels.teams.setup.availability.fileAccessApprovedHint": "It can take up to an hour to apply.", "agents.channels.teams.setup.availability.summarySeparator": " · ", "agents.channels.teams.setup.install.identityTooltip": "Name and avatar come from the agent. To change them, edit the agent and download the package again.", @@ -9429,7 +9430,6 @@ "agents.channels.teams.setup.install.button": "Download app package", "agents.channels.teams.setup.install.hint": "No Upload an app option? Ask your Teams admin to allow custom app uploads.", "agents.channels.teams.setup.install.downloadFailed": "Could not download the app package. Try again.", - "agents.channels.teams.setup.publishNotice": "Publish this agent before you message it in Teams.", "agents.channels.telegram.setup.credential.title": "Add credential", "agents.channels.telegram.setup.access.title": "Set access and restrictions", "agents.channels.telegram.setup.connect.title": "Connect Telegram", @@ -9797,7 +9797,7 @@ "agents.channels.teams.managed.connect.lockedBySignIn": "Sign in with Microsoft again to continue.", "agents.channels.teams.managed.connect.button": "Sign in with Microsoft", "agents.channels.teams.managed.connect.reconnect": "This sign-in is missing a permission the setup now needs. Sign in again to continue.", - "agents.channels.teams.managed.connect.failed": "The Microsoft sign-in did not finish. If it stopped at a permissions screen, an administrator has to approve n8n for your organization once before anyone can use this setup.", + "agents.channels.teams.managed.connect.failed": "Sign-in didn't finish. If you saw “Need admin approval”, an admin in your organization needs to approve n8n once.", "agents.channels.teams.managed.connect.edit": "Edit this sign-in", "agents.channels.teams.managed.createApp.title": "Create Teams app", "agents.channels.teams.managed.createApp.description": "Registers this agent with Microsoft, so Teams knows who it is.", @@ -9865,14 +9865,14 @@ "agents.channels.teams.managed.errors.signInFirst": "Sign in with Microsoft first.", "agents.channels.teams.managed.errors.createAppFirst": "Create the Teams app first.", "agents.channels.teams.managed.errors.credentialMissing": "The Microsoft sign-in could not be loaded. Try again.", - "agents.channels.modal.teamsResourcesNotDeleted.title": "Some Microsoft resources are still there", - "agents.channels.modal.teamsResourcesNotDeleted.message": "n8n did not delete the app registration, the bot or the Teams app, because other people may still have the app installed. Remove them yourself if you no longer need them:", - "agents.channels.modal.teamsResourcesNotDeleted.link": "Open Microsoft Entra", + "agents.channels.modal.teamsResourcesNotDeleted.title": "The agent is still in Teams but won't respond", + "agents.channels.modal.teamsResourcesNotDeleted.message": "Remove the Teams app, Azure Bot and app registration manually.", + "agents.channels.modal.teamsResourcesNotDeleted.link": "Open Teams", "agents.channels.teams.remove.title": "Remove Microsoft Teams?", "agents.channels.teams.remove.description": "Your agent will be disconnected from Microsoft Teams. Messages already sent will remain in Teams. To reconnect, you'll need to set up Microsoft Teams again.", "agents.channels.teams.remove.confirm": "Yes, remove", - "agents.channels.teams.managed.connect.adminConsent": "Sign-in blocked by a permissions screen?", - "agents.channels.teams.managed.connect.adminConsentHint": "A Microsoft administrator approves n8n once for the whole organization. After that, signing in just works.", + "agents.channels.teams.managed.connect.adminConsent": "Need admin approval? An admin in your organization needs to approve n8n once.", + "agents.channels.teams.managed.connect.adminConsentLink": "Copy link for an admin", "agents.channels.teams.managed.createBot.checking": "Looking for an Azure subscription n8n can use…", "agents.channels.teams.managed.createBot.retry": "Check again for an Azure subscription" } diff --git a/packages/frontend/editor-ui/src/features/agents/__tests__/AgentModal.test.ts b/packages/frontend/editor-ui/src/features/agents/__tests__/AgentModal.test.ts index cc8638c63b0..6268a518e87 100644 --- a/packages/frontend/editor-ui/src/features/agents/__tests__/AgentModal.test.ts +++ b/packages/frontend/editor-ui/src/features/agents/__tests__/AgentModal.test.ts @@ -189,6 +189,19 @@ describe('AgentModal', () => { expect(document.activeElement).toBe(wrapper.get('[data-test-id="first-body-field"]').element); }); + it('focuses a marked container instead of the field inside it', async () => { + const wrapper = mountModal( + {}, + { + default: + '
', + }, + ); + await flushPromises(); + + expect(document.activeElement).toBe(wrapper.get('[data-test-id="marked"]').element); + }); + it('uses the dialog fallback focus when the body has no interactive control', async () => { const wrapper = mountModal( { editableTitle: true }, diff --git a/packages/frontend/editor-ui/src/features/agents/__tests__/utils/ActionDropdownTestStub.ts b/packages/frontend/editor-ui/src/features/agents/__tests__/utils/ActionDropdownTestStub.ts index 63b30ee7532..b9ea6d7b441 100644 --- a/packages/frontend/editor-ui/src/features/agents/__tests__/utils/ActionDropdownTestStub.ts +++ b/packages/frontend/editor-ui/src/features/agents/__tests__/utils/ActionDropdownTestStub.ts @@ -2,7 +2,7 @@ export const ActionDropdownTestStub = { name: 'ActionDropdown', template: - '
', + '
', props: ['items', 'placement', 'teleported'], emits: ['select'], }; diff --git a/packages/frontend/editor-ui/src/features/agents/channels/AgentChannelStandardEditView.vue b/packages/frontend/editor-ui/src/features/agents/channels/AgentChannelStandardEditView.vue index d71694c10e9..a93fe2bf9c7 100644 --- a/packages/frontend/editor-ui/src/features/agents/channels/AgentChannelStandardEditView.vue +++ b/packages/frontend/editor-ui/src/features/agents/channels/AgentChannelStandardEditView.vue @@ -23,7 +23,8 @@ defineExpose({ currentSettings, validationError, saveLabel, beforeSave, afterSav