Skip to content

Commit 8d7f317

Browse files
committed
fix(search): clear onboarding readiness after credential disconnect
1 parent 09cab78 commit 8d7f317

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎apps/sim/lib/knowledge/__integration__/search-mcp-setup.integration.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
import { getCredentialGroup } from '@/lib/credential-groups/service'
3333
import { SLACK_MANAGED_USER_SCOPES } from '@/lib/credential-groups/slack-managed-user-scopes'
3434
import { createOrganizationAccountsGroup } from '@/lib/credential-groups/workspace-accounts'
35+
import { deleteConnectionCredential } from '@/lib/credentials/deletion'
3536
import { acquireAdvisoryXactLock, tryAcquireAdvisoryXactLock } from '@/lib/db/advisory-locks'
3637
import {
3738
approveSearchIntegration,
@@ -375,6 +376,19 @@ describe('atomic organization live Search MCP setup', () => {
375376
}
376377
)
377378

379+
it('stops reporting a service source as configured after its credential is deleted', async () => {
380+
const source = await seedServiceSource('google_drive')
381+
expect(await integrationStatus('google_drive')).toMatchObject({ configuredServiceSource: true })
382+
await deleteConnectionCredential({
383+
credentialId: source.credentialId,
384+
organizationId: ids.organization,
385+
reason: 'user_delete',
386+
})
387+
expect(await integrationStatus('google_drive')).toMatchObject({
388+
configuredServiceSource: false,
389+
})
390+
})
391+
378392
it('requires the selected service source to belong to this organization and provider', async () => {
379393
const source = await seedServiceSource('google_drive')
380394
const otherOrganizationId = generateId()

‎apps/sim/lib/knowledge/application/search-integrations.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ export const listSearchIntegrations = defineAuthorizedKnowledgeUseCase({
149149
),
150150
and(
151151
sql`requested.provider <> 'gitlab'`,
152-
eq(knowledgeConnector.id, sql`requested.source_id`)
152+
eq(knowledgeConnector.id, sql`requested.source_id`),
153+
isNotNull(knowledgeConnector.credentialId)
153154
)
154155
)
155156
)

0 commit comments

Comments
 (0)