From 96d4b0ec230c288c99a5456c393c367faf27dc73 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Thu, 25 Apr 2024 22:13:58 +0700 Subject: [PATCH] UBERF-6725 Use workspace url instead of id in guest link (#5469) Signed-off-by: Alexander Onnikov --- server-plugins/guest-resources/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server-plugins/guest-resources/src/index.ts b/server-plugins/guest-resources/src/index.ts index c2a96875b6..55a6ccd48d 100644 --- a/server-plugins/guest-resources/src/index.ts +++ b/server-plugins/guest-resources/src/index.ts @@ -21,7 +21,7 @@ import { TxCreateDoc, TxOperations, TxProcessor, - WorkspaceId, + WorkspaceIdWithUrl, concatLink, generateId } from '@hcengineering/core' @@ -54,13 +54,13 @@ export async function OnPublicLinkCreate (tx: Tx, control: TriggerControl): Prom return res } -export function getPublicLinkUrl (workspace: WorkspaceId): string { +export function getPublicLinkUrl (workspace: WorkspaceIdWithUrl): string { const front = getMetadata(serverCore.metadata.FrontUrl) ?? '' - const path = `${guestId}/${workspace.name}` + const path = `${guestId}/${workspace.workspaceUrl}` return concatLink(front, path) } -function generateUrl (linkId: Ref, workspace: WorkspaceId): string { +function generateUrl (linkId: Ref, workspace: WorkspaceIdWithUrl): string { const token = generateToken(guestAccountEmail, workspace, { linkId, guest: 'true' }) return `${getPublicLinkUrl(workspace)}?token=${token}` } @@ -68,7 +68,7 @@ function generateUrl (linkId: Ref, workspace: WorkspaceId): string { export async function getPublicLink ( doc: Doc, client: TxOperations, - workspace: WorkspaceId, + workspace: WorkspaceIdWithUrl, revokable: boolean = true ): Promise { const current = await client.findOne(guest.class.PublicLink, { attachedTo: doc._id })