From cc7a59ec8590e0455554c53e4d7e6f6a3aef894e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 9 Feb 2024 18:58:03 +0800 Subject: [PATCH 1/6] allow deep link to concierge page --- src/libs/actions/Report.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 2d13624277f0..09a7b9f8676d 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -2148,10 +2148,7 @@ function openReportFromDeepLink(url: string, isAuthenticated: boolean) { Session.waitForUserSignIn().then(() => { Navigation.waitForProtectedRoutes().then(() => { const route = ReportUtils.getRouteFromLink(url); - if (route === ROUTES.CONCIERGE) { - navigateToConciergeChat(true); - return; - } + if (route && Session.isAnonymousUser() && !Session.canAccessRouteByAnonymousUser(route)) { Session.signOutAndRedirectToSignIn(true); return; From d89951a78b539e1b972eaf5d5f4fa75edcea1cae Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 9 Feb 2024 18:58:24 +0800 Subject: [PATCH 2/6] add concierge to route that can be access anonymous user --- src/libs/actions/Session/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index d000d5ebfbec..b1083af5a32a 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -874,7 +874,7 @@ const canAccessRouteByAnonymousUser = (route: string) => { if (route.startsWith('/')) { routeRemovedReportId = routeRemovedReportId.slice(1); } - const routesCanAccessByAnonymousUser = [ROUTES.SIGN_IN_MODAL, ROUTES.REPORT_WITH_ID_DETAILS.route, ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.route]; + const routesCanAccessByAnonymousUser = [ROUTES.SIGN_IN_MODAL, ROUTES.REPORT_WITH_ID_DETAILS.route, ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.route, ROUTES.CONCIERGE]; if ((routesCanAccessByAnonymousUser as string[]).includes(routeRemovedReportId)) { return true; From 03e64f6c038a929525c7741065e31ef51f36d2f5 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 9 Feb 2024 18:59:06 +0800 Subject: [PATCH 3/6] remove unused param --- src/libs/actions/Report.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 09a7b9f8676d..5b393a7ecc61 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -1681,15 +1681,11 @@ function updateWriteCapabilityAndNavigate(report: Report, newValue: WriteCapabil /** * Navigates to the 1:1 report with Concierge - * - * @param ignoreConciergeReportID - Flag to ignore conciergeChatReportID during navigation. The default behavior is to not ignore. */ -function navigateToConciergeChat(ignoreConciergeReportID = false, shouldDismissModal = false) { +function navigateToConciergeChat(shouldDismissModal = false) { // If conciergeChatReportID contains a concierge report ID, we navigate to the concierge chat using the stored report ID. // Otherwise, we would find the concierge chat and navigate to it. - // Now, when user performs sign-out and a sign-in again, conciergeChatReportID may contain a stale value. - // In order to prevent navigation to a stale value, we use ignoreConciergeReportID to forcefully find and navigate to concierge chat. - if (!conciergeChatReportID || ignoreConciergeReportID) { + if (!conciergeChatReportID) { // In order to avoid creating concierge repeatedly, // we need to ensure that the server data has been successfully pulled Welcome.serverDataIsReadyPromise().then(() => { From 80522275baa6f00b72992478f8df5180226abbea Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 9 Feb 2024 18:59:31 +0800 Subject: [PATCH 4/6] clear concierge id when sign out --- src/libs/actions/Report.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 5b393a7ecc61..941572a16407 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -85,12 +85,14 @@ type ActionSubscriber = { callback: SubscriberCallback; }; +let conciergeChatReportID: string | undefined; let currentUserAccountID = -1; Onyx.connect({ key: ONYXKEYS.SESSION, callback: (value) => { // When signed out, val is undefined if (!value?.accountID) { + conciergeChatReportID = undefined; return; } @@ -167,7 +169,6 @@ Onyx.connect({ }); const allReports: OnyxCollection = {}; -let conciergeChatReportID: string | undefined; const typingWatchTimers: Record = {}; let reportIDDeeplinkedFromOldDot: string | undefined; From 18552c2403c5fe36705c68f701056ed11d5bae56 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 9 Feb 2024 19:00:11 +0800 Subject: [PATCH 5/6] remove unused param --- src/pages/ReimbursementAccount/ValidationStep.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/ValidationStep.js b/src/pages/ReimbursementAccount/ValidationStep.js index 6451cdb2a102..6501befb72ac 100644 --- a/src/pages/ReimbursementAccount/ValidationStep.js +++ b/src/pages/ReimbursementAccount/ValidationStep.js @@ -205,7 +205,7 @@ function ValidationStep({reimbursementAccount, translate, onBackButtonPress, acc {translate('validationStep.letsChatText')}