From 84f3f0947c5a0cacc8d51fdebdb8f74bf51a490b Mon Sep 17 00:00:00 2001 From: Flavien David Date: Thu, 4 Apr 2024 17:52:40 +0200 Subject: [PATCH 1/3] Skip reporting Confluence data if oauth token error --- connectors/src/connectors/confluence/temporal/activities.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index 8b0688de6b25..b86081f3fdf2 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.errorType === "oauth_token_revoked") { + return false; + } // We look for the oldest updated data. const oldestPageSync = await ConfluencePage.findOne({ From dd7d43f06a0a38cb54715ac31318483ce70c85c4 Mon Sep 17 00:00:00 2001 From: Flavien David Date: Thu, 4 Apr 2024 17:56:04 +0200 Subject: [PATCH 2/3] :sparkles: --- connectors/src/connectors/confluence/temporal/activities.ts | 2 +- connectors/src/resources/connector_resource.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index b86081f3fdf2..50be2df6cf06 100644 --- a/connectors/src/connectors/confluence/temporal/activities.ts +++ b/connectors/src/connectors/confluence/temporal/activities.ts @@ -614,7 +614,7 @@ export async function confluenceGetReportPersonalActionActivity( const { connectorId, userAccountId } = params; const connector = await fetchConfluenceConnector(connectorId); - if (connector.errorType === "oauth_token_revoked") { + if (connector.hasExternalAuthError()) { return false; } diff --git a/connectors/src/resources/connector_resource.ts b/connectors/src/resources/connector_resource.ts index c1cf2ae61ae8..1b59fd66ef20 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() }); } + + hasExternalAuthError() { + return this.errorType === "oauth_token_revoked"; + } } From ee2d4998c8aab450bc05bc7828b49ed86c8646df Mon Sep 17 00:00:00 2001 From: Flavien David Date: Thu, 4 Apr 2024 17:58:02 +0200 Subject: [PATCH 3/3] :sparkles: --- connectors/src/connectors/confluence/temporal/activities.ts | 2 +- connectors/src/resources/connector_resource.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index 50be2df6cf06..dc2e7627e0d2 100644 --- a/connectors/src/connectors/confluence/temporal/activities.ts +++ b/connectors/src/connectors/confluence/temporal/activities.ts @@ -614,7 +614,7 @@ export async function confluenceGetReportPersonalActionActivity( const { connectorId, userAccountId } = params; const connector = await fetchConfluenceConnector(connectorId); - if (connector.hasExternalAuthError()) { + if (connector.isAuthTokenRevoked) { return false; } diff --git a/connectors/src/resources/connector_resource.ts b/connectors/src/resources/connector_resource.ts index 1b59fd66ef20..9b446f3de7eb 100644 --- a/connectors/src/resources/connector_resource.ts +++ b/connectors/src/resources/connector_resource.ts @@ -153,7 +153,7 @@ export class ConnectorResource extends BaseResource { return this.update({ pausedAt: new Date() }); } - hasExternalAuthError() { + get isAuthTokenRevoked() { return this.errorType === "oauth_token_revoked"; } }