From 23fab2376f5cd1fafa6b636eac43f196486f57de Mon Sep 17 00:00:00 2001 From: truph01 Date: Mon, 11 Nov 2024 09:17:43 +0700 Subject: [PATCH] fix: View your subscription link opens Subscription page then back to Workspace --- src/libs/actions/Policy/PerDiem.ts | 4 ++-- src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Policy/PerDiem.ts b/src/libs/actions/Policy/PerDiem.ts index 2ce31fd4c921..1f6f0cf3dc9a 100644 --- a/src/libs/actions/Policy/PerDiem.ts +++ b/src/libs/actions/Policy/PerDiem.ts @@ -51,7 +51,7 @@ function generateCustomUnitID(): string { return NumberUtils.generateHexadecimalValue(13); } -function enablePerDiem(policyID: string, enabled: boolean, customUnitID?: string) { +function enablePerDiem(policyID: string, enabled: boolean, customUnitID?: string, disableRedirect?: boolean) { const doesCustomUnitExists = !!customUnitID; const finalCustomUnitID = doesCustomUnitExists ? customUnitID : generateCustomUnitID(); const optimisticCustomUnit = { @@ -104,7 +104,7 @@ function enablePerDiem(policyID: string, enabled: boolean, customUnitID?: string API.write(WRITE_COMMANDS.TOGGLE_POLICY_PER_DIEM, parameters, onyxData); - if (enabled && getIsNarrowLayout()) { + if (enabled && getIsNarrowLayout() && !disableRedirect) { navigateWhenEnableFeature(policyID); } } diff --git a/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx b/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx index d5ad6e7b4d1c..4cc26399034e 100644 --- a/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx +++ b/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx @@ -81,7 +81,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { Policy.enableCompanyCards(policyID, true, true); break; case CONST.UPGRADE_FEATURE_INTRO_MAPPING.perDiem.id: - PerDiem.enablePerDiem(policyID, true, perDiemCustomUnit?.customUnitID); + PerDiem.enablePerDiem(policyID, true, perDiemCustomUnit?.customUnitID, true); break; default: }