From e3e4bad839b075757b5e31f5c42175d5961a5e34 Mon Sep 17 00:00:00 2001 From: Flavien David Date: Thu, 4 Apr 2024 18:00:38 +0200 Subject: [PATCH] Skip reporting Confluence data if oauth token error (#4574) * Skip reporting Confluence data if oauth token error * :sparkles: * :sparkles: --- connectors/src/connectors/confluence/temporal/activities.ts | 3 +++ connectors/src/resources/connector_resource.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index 8b0688de6b25..dc2e7627e0d2 100644 --- a/connectors/src/connectors/confluence/temporal/activities.ts +++ b/connectors/src/connectors/confluence/temporal/activities.ts @@ -614,6 +614,9 @@ export async function confluenceGetReportPersonalActionActivity( const { connectorId, userAccountId } = params; const connector = await fetchConfluenceConnector(connectorId); + if (connector.isAuthTokenRevoked) { + return false; + } // We look for the oldest updated data. const oldestPageSync = await ConfluencePage.findOne({ diff --git a/connectors/src/resources/connector_resource.ts b/connectors/src/resources/connector_resource.ts index c1cf2ae61ae8..9b446f3de7eb 100644 --- a/connectors/src/resources/connector_resource.ts +++ b/connectors/src/resources/connector_resource.ts @@ -152,4 +152,8 @@ export class ConnectorResource extends BaseResource { async markAsPaused() { return this.update({ pausedAt: new Date() }); } + + get isAuthTokenRevoked() { + return this.errorType === "oauth_token_revoked"; + } }