mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03: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,
|
||||
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<PublicLink>, workspace: WorkspaceId): string {
|
||||
function generateUrl (linkId: Ref<PublicLink>, workspace: WorkspaceIdWithUrl): string {
|
||||
const token = generateToken(guestAccountEmail, workspace, { linkId, guest: 'true' })
|
||||
return `${getPublicLinkUrl(workspace)}?token=${token}`
|
||||
}
|
||||
@ -68,7 +68,7 @@ function generateUrl (linkId: Ref<PublicLink>, workspace: WorkspaceId): string {
|
||||
export async function getPublicLink (
|
||||
doc: Doc,
|
||||
client: TxOperations,
|
||||
workspace: WorkspaceId,
|
||||
workspace: WorkspaceIdWithUrl,
|
||||
revokable: boolean = true
|
||||
): Promise<string> {
|
||||
const current = await client.findOne(guest.class.PublicLink, { attachedTo: doc._id })
|
||||
|
Loading…
Reference in New Issue
Block a user