From e2a4724792c3dad195614537f2f88d7a71b8d81d Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Tue, 23 Jan 2024 11:32:46 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20links=20in=20History=20(?= =?UTF-8?q?#19551)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://linear.app/tryghost/issue/PROD-331/post-and-offer-links-404-in-history - Links were using Ember route instead of absolute routes, causing 404s. --- apps/admin-x-framework/src/api/actions.ts | 6 +++--- .../src/components/settings/advanced/HistoryModal.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/admin-x-framework/src/api/actions.ts b/apps/admin-x-framework/src/api/actions.ts index 5941de2c3f..e9f015bcde 100644 --- a/apps/admin-x-framework/src/api/actions.ts +++ b/apps/admin-x-framework/src/api/actions.ts @@ -132,7 +132,7 @@ export const getLinkTarget = (action: Action): InternalLink | ExternalLink | und return { isExternal: true, - route: 'editor.edit', + route: `editor/${resourceType}/${action.resource.id}`, models: [resourceType, action.resource.id] }; case 'integration': @@ -145,10 +145,10 @@ export const getLinkTarget = (action: Action): InternalLink | ExternalLink | und if (!action.resource || !action.resource.id) { return; } - + // replace with Settings route once Offers X GA is released return { isExternal: true, - route: 'offer', + route: `offers/${action.resource.id}`, models: [action.resource.id] }; case 'tag': diff --git a/apps/admin-x-settings/src/components/settings/advanced/HistoryModal.tsx b/apps/admin-x-settings/src/components/settings/advanced/HistoryModal.tsx index d2423843a7..26b9ccf85b 100644 --- a/apps/admin-x-settings/src/components/settings/advanced/HistoryModal.tsx +++ b/apps/admin-x-settings/src/components/settings/advanced/HistoryModal.tsx @@ -131,7 +131,7 @@ const HistoryActionDescription: React.FC<{action: Action}> = ({action}) => { const linkTarget = getLinkTarget(action); if (linkTarget) { - return { + return { e.preventDefault(); updateRoute(linkTarget); }}>{action.resource?.title || action.resource?.name};