Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2025-02-06 11:43:07 +05:00 committed by GitHub
parent 5f294caa1f
commit 608759ad56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 12 deletions

View File

@ -7,7 +7,7 @@ import {
navigate,
languageStore
} from '@hcengineering/ui'
import { type Ref, type Doc, type Class, generateId } from '@hcengineering/core'
import { type Ref, type Doc, type Class, generateId, concatLink } from '@hcengineering/core'
import activity, { type ActivityMessage } from '@hcengineering/activity'
import {
type Channel,
@ -19,10 +19,10 @@ import {
import { type DocNotifyContext, notificationId } from '@hcengineering/notification'
import workbench, { type Widget, workbenchId, type LocationData } from '@hcengineering/workbench'
import { classIcon, getObjectLinkId, parseLinkId } from '@hcengineering/view-resources'
import { getClient } from '@hcengineering/presentation'
import presentation, { getClient } from '@hcengineering/presentation'
import view, { encodeObjectURI, decodeObjectURI } from '@hcengineering/view'
import { createWidgetTab, isElementFromSidebar, sidebarStore } from '@hcengineering/workbench-resources'
import { type Asset, type IntlString, translate } from '@hcengineering/platform'
import { type Asset, getMetadata, type IntlString, translate } from '@hcengineering/platform'
import contact from '@hcengineering/contact'
import { get } from 'svelte/store'
@ -113,8 +113,10 @@ export async function getMessageLink (message: ActivityMessage): Promise<string>
}
const id = encodeURIComponent(encodeObjectURI(_id, _class))
return `${window.location.protocol}//${window.location.host}/${workbenchId}/${location.path[1]}/${chunterId}/${id}${threadParent}?message=${message._id}`
const frontUrl = getMetadata(presentation.metadata.FrontUrl)
const protocolAndHost = frontUrl ?? `${window.location.protocol}//${window.location.host}`
const path = `${workbenchId}/${location.path[1]}/${chunterId}/${id}${threadParent}?message=${message._id}`
return concatLink(protocolAndHost, path)
}
export async function chunterSpaceLinkFragmentProvider (doc: ChunterSpace): Promise<Location> {

View File

@ -13,7 +13,9 @@
// limitations under the License.
-->
<script lang="ts">
import { NavLink } from '@hcengineering/presentation'
import { concatLink } from '@hcengineering/core'
import { getMetadata } from '@hcengineering/platform'
import presentation, { NavLink } from '@hcengineering/presentation'
import { trackerId, type Issue, type IssueParentInfo } from '@hcengineering/tracker'
import { getCurrentLocation, locationToUrl } from '@hcengineering/ui'
@ -26,7 +28,8 @@
loc.path[2] = trackerId
loc.path[3] = parentInfo.identifier
loc.path.length = 4
return `${window.location.origin}${locationToUrl(loc)}`
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
return concatLink(frontUrl, locationToUrl(loc))
}
</script>

View File

@ -16,16 +16,20 @@
-->
<script lang="ts">
import { NavLink } from '@hcengineering/presentation'
import presentation, { NavLink } from '@hcengineering/presentation'
import { locationToUrl } from '@hcengineering/ui'
import { Document } from '@hcengineering/controlled-documents'
import { documentRoute } from '../routing/routes/documentRoute'
import { getMetadata } from '@hcengineering/platform'
import { concatLink } from '@hcengineering/core'
export let value: Document
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
let href: string | undefined
$: {
href = `${window.location.origin}${locationToUrl(documentRoute.build({ id: value._id }))}`
href = concatLink(frontUrl, locationToUrl(documentRoute.build({ id: value._id })))
}
</script>

View File

@ -13,11 +13,12 @@
// limitations under the License.
-->
<script lang="ts">
import { Doc, Hierarchy } from '@hcengineering/core'
import { NavLink, getClient } from '@hcengineering/presentation'
import { concatLink, Doc, Hierarchy } from '@hcengineering/core'
import presentation, { NavLink, getClient } from '@hcengineering/presentation'
import { AnyComponent, getPanelURI, locationToUrl } from '@hcengineering/ui'
import view from '../plugin'
import { getObjectLinkFragment, restrictionStore } from '../utils'
import { getMetadata } from '@hcengineering/platform'
export let object: Doc | undefined
export let disabled: boolean = false
@ -50,7 +51,8 @@
const panelComponent = hierarchy.classHierarchyMixin(object._class, view.mixin.ObjectPanel)
const comp = panelComponent?.component ?? component
const loc = await getObjectLinkFragment(hierarchy, object, props, comp)
href = `${window.location.origin}${locationToUrl(loc)}`
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
href = concatLink(frontUrl, locationToUrl(loc))
}
$: if (object !== undefined) getHref(object)