Skip to content

Commit

Permalink
add a function getConfluenceSpaceUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Jan 16, 2025
1 parent e5b1b68 commit 1fd2e88
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions connectors/src/connectors/confluence/lib/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,30 @@ 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 urlSuffix = isConfluenceSpaceModel(space)
? space.urlSuffix
: space._links.webui;
const spaceId = isConfluenceSpaceModel(space) ? space.spaceId : space.id;

return {
internalId: makeSpaceInternalId(spaceId),
parentInternalId: null,
type: "folder",
title: space.name || "Unnamed Space",
sourceUrl: `${baseUrl}/wiki${urlSuffix}`,
sourceUrl: getConfluenceSpaceUrl(space, baseUrl),
expandable: isExpandable,
permission,
lastUpdatedAt: null,
Expand Down

0 comments on commit 1fd2e88

Please sign in to comment.