From 2c8185dfe4c2bfb3cbb945c08a3527eaaa8f1d9b Mon Sep 17 00:00:00 2001
From: mkzie2 <mkzie2@gmail.com>
Date: Tue, 28 Oct 2025 11:25:52 +0700
Subject: [PATCH 1/4] fix: New user is dropped in self dm first after creating
 a workspace during onboarding

---
 src/libs/navigateAfterOnboarding.ts       |  6 +++---
 tests/unit/navigateAfterOnboardingTest.ts | 10 ++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/libs/navigateAfterOnboarding.ts b/src/libs/navigateAfterOnboarding.ts
index 7c02ad4d5ced..6f86ac8b9f63 100644
--- a/src/libs/navigateAfterOnboarding.ts
+++ b/src/libs/navigateAfterOnboarding.ts
@@ -2,7 +2,7 @@ import ROUTES from '@src/ROUTES';
 import {setDisableDismissOnEscape} from './actions/Modal';
 import shouldOpenOnAdminRoom from './Navigation/helpers/shouldOpenOnAdminRoom';
 import Navigation from './Navigation/Navigation';
-import {findLastAccessedReport, isConciergeChatReport} from './ReportUtils';
+import {findLastAccessedReport, isConciergeChatReport, isSelfDM} from './ReportUtils';
 
 const navigateAfterOnboarding = (
     isSmallScreenWidth: boolean,
@@ -26,8 +26,8 @@ const navigateAfterOnboarding = (
     } else {
         const lastAccessedReport = findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom() && !shouldPreventOpenAdminRoom);
         const lastAccessedReportID = lastAccessedReport?.reportID;
-        // we don't want to navigate to newly created workspaces after onboarding is completed.
-        if (lastAccessedReportID && lastAccessedReport.policyID !== onboardingPolicyID && !isConciergeChatReport(lastAccessedReport)) {
+        // we don't want to navigate to newly created workspaces/selfDM after onboarding is completed.
+        if (lastAccessedReportID && lastAccessedReport.policyID !== onboardingPolicyID && !isConciergeChatReport(lastAccessedReport) && !isSelfDM(lastAccessedReport)) {
             reportID = lastAccessedReportID;
         }
     }
diff --git a/tests/unit/navigateAfterOnboardingTest.ts b/tests/unit/navigateAfterOnboardingTest.ts
index b2accc2bd420..e49084b34a39 100644
--- a/tests/unit/navigateAfterOnboardingTest.ts
+++ b/tests/unit/navigateAfterOnboardingTest.ts
@@ -42,6 +42,7 @@ jest.mock('@libs/ReportUtils', () => ({
     shouldDisplayViolationsRBRInLHN: jest.requireActual<typeof ReportUtils>('@libs/ReportUtils').shouldDisplayViolationsRBRInLHN,
     generateIsEmptyReport: jest.requireActual<typeof ReportUtils>('@libs/ReportUtils').generateIsEmptyReport,
     isExpenseReport: jest.requireActual<typeof ReportUtils>('@libs/ReportUtils').isExpenseReport,
+    isSelfDM: jest.requireActual<typeof ReportUtils>('@libs/ReportUtils').isSelfDM,
 }));
 
 jest.mock('@libs/Navigation/helpers/shouldOpenOnAdminRoom', () => ({
@@ -104,6 +105,15 @@ describe('navigateAfterOnboarding', () => {
         expect(Navigation.navigate).not.toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(REPORT_ID));
     });
 
+    it('should not navigate to last accessed report if it is selfDM chat on small screens', () => {
+        const lastAccessedReport = {reportID: REPORT_ID, chatType: CONST.REPORT.CHAT_TYPE.SELF_DM};
+        mockFindLastAccessedReport.mockReturnValue(lastAccessedReport);
+        mockShouldOpenOnAdminRoom.mockReturnValue(false);
+
+        navigateAfterOnboarding(true, true, ONBOARDING_POLICY_ID, ONBOARDING_ADMINS_CHAT_REPORT_ID);
+        expect(Navigation.navigate).not.toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(REPORT_ID));
+    });
+
     it('should navigate to last accessed report if shouldOpenOnAdminRoom is true on small screens', () => {
         const navigate = jest.spyOn(Navigation, 'navigate');
         const lastAccessedReport = {reportID: REPORT_ID};

From 02bd21d074992849728e83ab4259a17e2289996f Mon Sep 17 00:00:00 2001
From: mkzie2 <mkzie2@gmail.com>
Date: Thu, 30 Oct 2025 20:36:25 +0700
Subject: [PATCH 2/4] provide more detailed explaination

---
 src/libs/navigateAfterOnboarding.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libs/navigateAfterOnboarding.ts b/src/libs/navigateAfterOnboarding.ts
index 6f86ac8b9f63..06eafece7a39 100644
--- a/src/libs/navigateAfterOnboarding.ts
+++ b/src/libs/navigateAfterOnboarding.ts
@@ -26,7 +26,7 @@ const navigateAfterOnboarding = (
     } else {
         const lastAccessedReport = findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom() && !shouldPreventOpenAdminRoom);
         const lastAccessedReportID = lastAccessedReport?.reportID;
-        // we don't want to navigate to newly created workspaces/selfDM after onboarding is completed.
+        // We need to send the user to the #admins room from the policy that was created while onboarding, instead of navigating to newly created workspaces/selfDM after onboarding is completed.
         if (lastAccessedReportID && lastAccessedReport.policyID !== onboardingPolicyID && !isConciergeChatReport(lastAccessedReport) && !isSelfDM(lastAccessedReport)) {
             reportID = lastAccessedReportID;
         }

From 19a364c507b1ed29d44cbba46b56c44fdf69204c Mon Sep 17 00:00:00 2001
From: mkzie2 <mkzie2@gmail.com>
Date: Thu, 30 Oct 2025 20:37:02 +0700
Subject: [PATCH 3/4] provide more detailed explaination

---
 src/libs/navigateAfterOnboarding.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libs/navigateAfterOnboarding.ts b/src/libs/navigateAfterOnboarding.ts
index 06eafece7a39..e39cda460abb 100644
--- a/src/libs/navigateAfterOnboarding.ts
+++ b/src/libs/navigateAfterOnboarding.ts
@@ -26,7 +26,8 @@ const navigateAfterOnboarding = (
     } else {
         const lastAccessedReport = findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom() && !shouldPreventOpenAdminRoom);
         const lastAccessedReportID = lastAccessedReport?.reportID;
-        // We need to send the user to the #admins room from the policy that was created while onboarding, instead of navigating to newly created workspaces/selfDM after onboarding is completed.
+        // We need to send the user to the #admins room from the policy that was created while onboarding, not newly created workspaces nor selfDM chats
+        // See https://github.com/Expensify/App/issues/61417 and https://github.com/Expensify/App/issues/73559 for more details.
         if (lastAccessedReportID && lastAccessedReport.policyID !== onboardingPolicyID && !isConciergeChatReport(lastAccessedReport) && !isSelfDM(lastAccessedReport)) {
             reportID = lastAccessedReportID;
         }

From 061dc024d9dfe43119abd0ef5460d478258a0ffa Mon Sep 17 00:00:00 2001
From: mkzie2 <mkzie2@gmail.com>
Date: Fri, 7 Nov 2025 13:42:58 +0700
Subject: [PATCH 4/4] change explanation

---
 src/libs/navigateAfterOnboarding.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/navigateAfterOnboarding.ts b/src/libs/navigateAfterOnboarding.ts
index aea67eedd92e..311277ee8275 100644
--- a/src/libs/navigateAfterOnboarding.ts
+++ b/src/libs/navigateAfterOnboarding.ts
@@ -25,8 +25,8 @@ const navigateAfterOnboarding = (
     } else {
         const lastAccessedReport = findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom() && !shouldPreventOpenAdminRoom);
         const lastAccessedReportID = lastAccessedReport?.reportID;
-        // We need to send the user to the #admins room from the policy that was created while onboarding, not newly created workspaces nor selfDM chats
-        // See https://github.com/Expensify/App/issues/61417 and https://github.com/Expensify/App/issues/73559 for more details.
+        // When the user goes through the onboarding flow, a workspace can be created if the user selects specific options. The user should be taken to the #admins room for that workspace because it is the most natural place for them to start their experience in the app.
+        // The user should never go to the self DM or the Concierge chat if a workspace was created during the onboarding flow.
         if (lastAccessedReportID && lastAccessedReport.policyID !== onboardingPolicyID && !isConciergeChatReport(lastAccessedReport) && !isSelfDM(lastAccessedReport)) {
             reportID = lastAccessedReportID;
         }
