mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-17 13:54:11 +00:00
UBERF-6725 Use workspace url instead of id in guest link (#5469)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
1e71183c78
commit
96d4b0ec23
@ -21,7 +21,7 @@ import {
|
|||||||
TxCreateDoc,
|
TxCreateDoc,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
TxProcessor,
|
TxProcessor,
|
||||||
WorkspaceId,
|
WorkspaceIdWithUrl,
|
||||||
concatLink,
|
concatLink,
|
||||||
generateId
|
generateId
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
@ -54,13 +54,13 @@ export async function OnPublicLinkCreate (tx: Tx, control: TriggerControl): Prom
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPublicLinkUrl (workspace: WorkspaceId): string {
|
export function getPublicLinkUrl (workspace: WorkspaceIdWithUrl): string {
|
||||||
const front = getMetadata(serverCore.metadata.FrontUrl) ?? ''
|
const front = getMetadata(serverCore.metadata.FrontUrl) ?? ''
|
||||||
const path = `${guestId}/${workspace.name}`
|
const path = `${guestId}/${workspace.workspaceUrl}`
|
||||||
return concatLink(front, path)
|
return concatLink(front, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateUrl (linkId: Ref<PublicLink>, workspace: WorkspaceId): string {
|
function generateUrl (linkId: Ref<PublicLink>, workspace: WorkspaceIdWithUrl): string {
|
||||||
const token = generateToken(guestAccountEmail, workspace, { linkId, guest: 'true' })
|
const token = generateToken(guestAccountEmail, workspace, { linkId, guest: 'true' })
|
||||||
return `${getPublicLinkUrl(workspace)}?token=${token}`
|
return `${getPublicLinkUrl(workspace)}?token=${token}`
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ function generateUrl (linkId: Ref<PublicLink>, workspace: WorkspaceId): string {
|
|||||||
export async function getPublicLink (
|
export async function getPublicLink (
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
client: TxOperations,
|
client: TxOperations,
|
||||||
workspace: WorkspaceId,
|
workspace: WorkspaceIdWithUrl,
|
||||||
revokable: boolean = true
|
revokable: boolean = true
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const current = await client.findOne(guest.class.PublicLink, { attachedTo: doc._id })
|
const current = await client.findOne(guest.class.PublicLink, { attachedTo: doc._id })
|
||||||
|
Loading…
Reference in New Issue
Block a user