diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 0712d2280b1a6..fed8104d1d9f0 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11447,7 +11447,7 @@ function prepareOnboardingOnyxData({ onboardingMessage = getOnboardingMessages().onboardingMessages[CONST.ONBOARDING_CHOICES.SUBMIT]; } - // Guides are assigned and tasks are posted in the #admins room for the MANAGE_TEAM and TRACK_WORKSPACE onboarding actions, except for emails that have a '+'. + // Only the MANAGE_TEAM onboarding action uses the #admins room (with a guide); TRACK_WORKSPACE uses Concierge. Excludes emails that have a '+'. const shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice); // When posting to admins room and the user is in the suggestedFollowups beta, we skip tasks in favor of backend-generated followups. const shouldUseFollowupsInsteadOfTasks = shouldPostTasksInAdminsRoom && Permissions.isBetaEnabled(CONST.BETAS.SUGGESTED_FOLLOWUPS, allBetas, betaConfiguration); @@ -12111,15 +12111,13 @@ function isChatUsedForOnboarding( /** * Whether onboarding tasks should be posted in the #admins room instead of Concierge. - * Onboarding guides are assigned to signup with emails that do not contain a '+' and select the "Manage my team's expenses" intent. + * Only the "Manage my team's expenses" (MANAGE_TEAM) intent uses the #admins room with a guide; + * Track and budget expenses (TRACK_WORKSPACE) uses Concierge chat. Guides are assigned to users who sign up + * with emails that do not contain a '+' and who select MANAGE_TEAM. */ function isPostingTasksInAdminsRoom(engagementChoice?: OnboardingPurpose): boolean { const userHasPhonePrimaryEmail = Str.endsWith(currentUserEmail ?? '', CONST.SMS.DOMAIN); - return ( - engagementChoice !== undefined && - [CONST.ONBOARDING_CHOICES.MANAGE_TEAM, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE].includes(engagementChoice as 'newDotManageTeam' | 'newDotTrackWorkspace') && - (!currentUserEmail?.includes('+') || userHasPhonePrimaryEmail) - ); + return engagementChoice !== undefined && engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM && (!currentUserEmail?.includes('+') || userHasPhonePrimaryEmail); } /** diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 5e28dd1c7e6a8..ee78189f711d9 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -3966,6 +3966,20 @@ describe('ReportUtils', () => { expect(isChatUsedForOnboarding(report, onboardingValue, undefined, CONST.ONBOARDING_CHOICES.MANAGE_TEAM)).toBeTruthy(); }); + it('should return false for admins room when engagement choice is TRACK_WORKSPACE (Concierge is used for onboarding)', async () => { + const onboardingValue = {hasCompletedGuidedSetupFlow: true} as Onboarding; + + await Onyx.multiSet({ + [ONYXKEYS.NVP_ONBOARDING]: onboardingValue, + }); + + const report = { + ...LHNTestUtils.getFakeReport(), + chatType: CONST.REPORT.CHAT_TYPE.POLICY_ADMINS, + }; + expect(isChatUsedForOnboarding(report, onboardingValue, undefined, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE)).toBeFalsy(); + }); + it('should return true for concierge chat when conciergeReportID matches report ID', async () => { const conciergeReportID = '12345'; const report: Report = {