From d2fdd6143c48bcabbf4ed1bc224808334dd6e4b5 Mon Sep 17 00:00:00 2001 From: Aubin <60398825+aubin-tchoi@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:29:29 +0100 Subject: [PATCH] remove the function getConfluenceSpaceUrl and replace call sites (#10056) --- .../src/connectors/confluence/lib/permissions.ts | 15 ++++----------- .../connectors/confluence/temporal/activities.ts | 4 +--- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/connectors/src/connectors/confluence/lib/permissions.ts b/connectors/src/connectors/confluence/lib/permissions.ts index 73c7e698ea2e..ce00bd712605 100644 --- a/connectors/src/connectors/confluence/lib/permissions.ts +++ b/connectors/src/connectors/confluence/lib/permissions.ts @@ -34,16 +34,6 @@ function isConfluenceSpaceModel( ); } -export function getConfluenceSpaceUrl( - space: ConfluenceSpace | ConfluenceSpaceType, - baseUrl: string -) { - const urlSuffix = isConfluenceSpaceModel(space) - ? space.urlSuffix - : space._links.webui; - return `${baseUrl}/wiki${urlSuffix}`; -} - export function createContentNodeFromSpace( space: ConfluenceSpace | ConfluenceSpaceType, baseUrl: string, @@ -51,13 +41,16 @@ export function createContentNodeFromSpace( { isExpandable }: { isExpandable: boolean } ): ContentNode { const spaceId = isConfluenceSpaceModel(space) ? space.spaceId : space.id; + const urlSuffix = isConfluenceSpaceModel(space) + ? space.urlSuffix + : space._links.webui; return { internalId: makeSpaceInternalId(spaceId), parentInternalId: null, type: "folder", title: space.name || "Unnamed Space", - sourceUrl: getConfluenceSpaceUrl(space, baseUrl), + sourceUrl: `${baseUrl}/wiki${urlSuffix}`, expandable: isExpandable, permission, lastUpdatedAt: null, diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index a30625f21bf2..a8c420f41b8b 100644 --- a/connectors/src/connectors/confluence/temporal/activities.ts +++ b/connectors/src/connectors/confluence/temporal/activities.ts @@ -23,7 +23,6 @@ import { makePageInternalId, makeSpaceInternalId, } from "@connectors/connectors/confluence/lib/internal_ids"; -import { getConfluenceSpaceUrl } from "@connectors/connectors/confluence/lib/permissions"; import { makeConfluenceDocumentUrl } from "@connectors/connectors/confluence/temporal/workflow_ids"; import { dataSourceConfigFromConnector } from "@connectors/lib/api/data_source_config"; import { concurrentExecutor } from "@connectors/lib/async_utils"; @@ -231,8 +230,7 @@ export async function confluenceUpsertSpaceFolderActivity({ parentId: null, title: spaceName, mimeType: MIME_TYPES.CONFLUENCE.SPACE, - sourceUrl: - spaceInDb?.urlSuffix && getConfluenceSpaceUrl(spaceInDb, baseUrl), + sourceUrl: spaceInDb?.urlSuffix && `${baseUrl}/wiki${spaceInDb.urlSuffix}`, }); }