Skip to content

Commit

Permalink
upsert the sourceUrl for confluence spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Jan 16, 2025
1 parent 1fd2e88 commit fcfcf69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions connectors/src/connectors/confluence/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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 @@ -209,20 +210,29 @@ export async function confluenceUpsertSpaceFolderActivity({
connectorId,
spaceId,
spaceName,
baseUrl,
}: {
connectorId: ModelId;
spaceId: string;
spaceName: string;
baseUrl: string;
}) {
const connector = await fetchConfluenceConnector(connectorId);

const spaceInDb = await ConfluenceSpace.findOne({
attributes: ["urlSuffix"],
where: { connectorId, spaceId },
});

await upsertDataSourceFolder({
dataSourceConfig: dataSourceConfigFromConnector(connector),
folderId: makeSpaceInternalId(spaceId),
parents: [makeSpaceInternalId(spaceId)],
parentId: null,
title: spaceName,
mimeType: MIME_TYPES.CONFLUENCE.SPACE,
sourceUrl:
spaceInDb?.urlSuffix && getConfluenceSpaceUrl(spaceInDb, baseUrl),
});
}

Expand Down
3 changes: 2 additions & 1 deletion connectors/src/connectors/confluence/temporal/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export async function confluenceSpaceSyncWorkflow(
const confluenceConfig = await fetchConfluenceConfigurationActivity(
params.connectorId
);
const { cloudId: confluenceCloudId } = confluenceConfig;
const { cloudId: confluenceCloudId, url: baseUrl } = confluenceConfig;

const spaceName = await confluenceGetSpaceNameActivity({
...params,
Expand All @@ -163,6 +163,7 @@ export async function confluenceSpaceSyncWorkflow(
connectorId,
spaceId,
spaceName,
baseUrl,
});

const allowedRootPageIds = await fetchAndUpsertRootPagesActivity({
Expand Down

0 comments on commit fcfcf69

Please sign in to comment.