From 032f63210579d746d317022a7447b7b574db33a9 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Thu, 16 Mar 2023 09:44:21 +0600 Subject: [PATCH] Short link fixes (#2744) Signed-off-by: Denis Bykhov --- plugins/chunter-resources/src/utils.ts | 2 +- .../src/components/OrganizationCard.svelte | 62 ++++++++++++------- plugins/contact-resources/src/utils.ts | 2 +- plugins/recruit-resources/src/utils.ts | 2 +- .../projects/ProjectPresenter.svelte | 1 + plugins/tracker-resources/src/issues.ts | 2 +- .../src/components/Workbench.svelte | 12 +++- 7 files changed, 54 insertions(+), 29 deletions(-) diff --git a/plugins/chunter-resources/src/utils.ts b/plugins/chunter-resources/src/utils.ts index 4b8ae2f18c..b385d33c4d 100644 --- a/plugins/chunter-resources/src/utils.ts +++ b/plugins/chunter-resources/src/utils.ts @@ -212,7 +212,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise
@@ -29,26 +44,29 @@
{#if organization} -
{ - if (!disabled) { - closeTooltip() - closePopup() - closePanel() - const loc = getCurrentLocation() - loc.path[3] = organization._id - loc.path.length = 4 - navigate(loc) - } - }} - > - {organization.name} + +
+ {organization.name} +
+
+ - {#if organization} - {organization.name} - {/if} {/if}
diff --git a/plugins/contact-resources/src/utils.ts b/plugins/contact-resources/src/utils.ts index 41044b08f4..448c8d59d0 100644 --- a/plugins/contact-resources/src/utils.ts +++ b/plugins/contact-resources/src/utils.ts @@ -220,7 +220,7 @@ async function generateLocation (loc: Location, shortLink: string): Promise diff --git a/plugins/tracker-resources/src/issues.ts b/plugins/tracker-resources/src/issues.ts index ce3edfe935..53e5247a3a 100644 --- a/plugins/tracker-resources/src/issues.ts +++ b/plugins/tracker-resources/src/issues.ts @@ -78,7 +78,7 @@ export async function generateIssueLocation (loc: Location, issueId: string): Pr const appComponent = loc.path[0] ?? '' const workspace = loc.path[1] ?? '' return { - path: [appComponent, workspace, trackerId, team._id, 'issues'], + path: [appComponent, workspace], fragment: generateIssuePanelUri(issue) } } diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index feb53c7aef..c0e118c4c3 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -220,11 +220,17 @@ // resolve short links const resolvedLocation = await resolveShortLink(loc) if (resolvedLocation && !areLocationsEqual(loc, resolvedLocation)) { - loc.path[2] = app = resolvedLocation.path[2] ?? app - loc.path[3] = space = (resolvedLocation.path[3] as Ref) ?? space + if (app !== resolvedLocation.path[2] && resolvedLocation.path[2] !== undefined) { + loc.path[2] = app = resolvedLocation.path[2] ?? app + loc.path[3] = space = (resolvedLocation.path[3] as Ref) ?? space + loc.path[4] = special = resolvedLocation.path[4] ?? special + } else if (space !== (resolvedLocation.path[3] as Ref) && resolvedLocation.path[3] !== undefined) { + loc.path[3] = space = (resolvedLocation.path[3] as Ref) ?? space + loc.path[4] = special = resolvedLocation.path[4] ?? special + } loc.path[4] = special = resolvedLocation.path[4] ?? special loc.fragment = fragment = resolvedLocation.fragment ?? fragment - navigate(resolvedLocation, false) + navigate(loc, false) } if (currentAppAlias !== app) {