UBER-532: Copy issue URL works wrong (#3529)

Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
This commit is contained in:
Maksim Karmatskikh
2023-08-02 10:42:43 +06:00
committed by GitHub
parent 3c376696f6
commit 1d064072c2
5 changed files with 42 additions and 26 deletions
@@ -1,5 +1,6 @@
<script lang="ts">
import { copyTextToClipboard, createQuery } from '@hcengineering/presentation'
import presentation, { copyTextToClipboard, createQuery } from '@hcengineering/presentation'
import { getMetadata } from '@hcengineering/platform'
import { Issue, IssueStatus } from '@hcengineering/tracker'
import view from '@hcengineering/view'
import {
@@ -77,8 +78,9 @@
const handleIssueOpened = () => {
if (params?.issueUrl) {
const url = new URL(params?.issueUrl)
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
if (url.origin === window.location.origin) {
if (url.origin === frontUrl) {
navigate(parseLocation(url))
}
}
+5 -2
View File
@@ -1,5 +1,6 @@
import { Doc, DocumentUpdate, Ref, RelatedDocument, TxOperations } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import presentation, { getClient } from '@hcengineering/presentation'
import { getMetadata } from '@hcengineering/platform'
import { Component, Issue, Project, Milestone, trackerId } from '@hcengineering/tracker'
import { Location, ResolvedLocation, getPanelURI, getCurrentResolvedLocation } from '@hcengineering/ui'
import { workbenchId } from '@hcengineering/workbench'
@@ -64,7 +65,9 @@ export async function issueLinkProvider (doc: Doc): Promise<string> {
export function generateIssueShortLink (issueId: string): string {
const location = getCurrentResolvedLocation()
return `${window.location.protocol}//${window.location.host}/${workbenchId}/${location.path[1]}/${trackerId}/${issueId}`
const frontUrl = getMetadata(presentation.metadata.FrontUrl)
const protocolAndHost = frontUrl ?? `${window.location.protocol}//${window.location.host}`
return `${protocolAndHost}/${workbenchId}/${location.path[1]}/${trackerId}/${issueId}`
}
export async function generateIssueLocation (loc: Location, issueId: string): Promise<ResolvedLocation | undefined> {