Skip to content

Commit

Permalink
remove the function getConfluenceSpaceUrl and replace call sites (#10056
Browse files Browse the repository at this point in the history
)
  • Loading branch information
aubin-tchoi authored and tdraier committed Jan 20, 2025
1 parent 3423993 commit d2fdd61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
15 changes: 4 additions & 11 deletions connectors/src/connectors/confluence/lib/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,23 @@ 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,
permission: ConnectorPermission,
{ 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,
Expand Down
4 changes: 1 addition & 3 deletions connectors/src/connectors/confluence/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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}`,
});
}

Expand Down

0 comments on commit d2fdd61

Please sign in to comment.