From 216fb2141b61744ad898249e28bcc79f09ea655a Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:26:38 +0530 Subject: [PATCH] fix: delete related api key when make.com app is disconnect (#23539) * add * fix: delete api keys when deleted * Update NavigationItem.tsx --- .../features/credentials/handleDeleteCredential.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/features/credentials/handleDeleteCredential.ts b/packages/features/credentials/handleDeleteCredential.ts index 7e57a7366d..a7739b81d8 100644 --- a/packages/features/credentials/handleDeleteCredential.ts +++ b/packages/features/credentials/handleDeleteCredential.ts @@ -390,18 +390,19 @@ const handleDeleteCredential = async ({ } } - // if zapier get disconnected, delete zapier apiKey, delete zapier webhooks and cancel all scheduled jobs from zapier - if (credential.app?.slug === "zapier") { + // if zapier or make get disconnected, delete its apiKey, delete its webhooks and cancel all scheduled jobs + if (credential.app?.slug === "zapier" || credential.app?.slug === "make") { + const ownerFilter = teamId ? { teamId } : { userId }; await prisma.apiKey.deleteMany({ where: { - userId: userId, - appId: "zapier", + ...ownerFilter, + appId: credential.app.slug, }, }); await prisma.webhook.deleteMany({ where: { - userId: userId, - appId: "zapier", + ...ownerFilter, + appId: credential.app.slug, }, });