From 5c1dc5f56794d3fae0696c7c96e563f24a0c1053 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sat, 29 Aug 2026 13:54:15 +0700 Subject: [PATCH 1/2] ntegrating conciergeChat parameter across multiple components --- src/libs/actions/Report/index.ts | 63 ++-- src/pages/Share/ShareDetailsPage.tsx | 2 + .../BaseReportActionContextMenu.tsx | 2 + .../report/ContextMenu/ContextMenuActions.tsx | 61 +++- .../ReportActionItemMessageWithExplain.tsx | 13 +- .../inbox/report/ReportActionItemThread.tsx | 14 +- tests/actions/ReportTest.ts | 279 +++++++++++------- 7 files changed, 281 insertions(+), 153 deletions(-) diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index 49c2af4b4bc4..31845e87fdb1 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -2616,7 +2616,7 @@ function navigateToAndOpenReport({ if (!shouldRevalidateExistingChat) { if (isOnboardingPending) { - openReport({reportID: chat.reportID, introSelected, isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, hasReportActions, currentUserAccountID}); + openReport({reportID: chat.reportID, introSelected, isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, hasReportActions, currentUserAccountID, conciergeChat}); } navigateToReport(chat.reportID, {shouldDismissModal, ...linkToOptions}); return; @@ -2805,8 +2805,11 @@ function navigateToAndOpenChildReport( // The personal details of the child report participants (the current user and the parent action's actor). participantsPersonalDetails: OnyxEntry, isSelfTourViewed: boolean | undefined, + conciergeChat: OnyxEntry, ) { - const report = childReport ?? createChildReport(childReport, parentReportAction, parentReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, participantsPersonalDetails); + const report = + childReport ?? + createChildReport(childReport, parentReportAction, parentReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, participantsPersonalDetails, conciergeChat); if (isSearchTopmostFullScreenRoute()) { Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: report.reportID, backTo: Navigation.getActiveRoute()})); @@ -2830,6 +2833,7 @@ function createChildReport( isSelfTourViewed: boolean | undefined, // The personal details of the child report participants (the current user and the parent action's actor). participantsPersonalDetails: OnyxEntry, + conciergeChat: OnyxEntry, ): Report { const participantAccountIDs = [...new Set([currentUserAccountID, Number(parentReportAction.actorAccountID)])]; // Threads from DMs and selfDMs don't have a chatType. All other threads inherit the chatType from their parent @@ -2874,6 +2878,7 @@ function createChildReport( isSelfTourViewed, hasReportActions: false, currentUserAccountID, + conciergeChat, }); } else { Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${childReportID}`, newChat); @@ -2886,28 +2891,43 @@ function createChildReport( * Creates an explanation thread for a report action with reasoning * Adds a "Please explain this to me." comment from the user */ -// TODO: update to object structure https://github.com/Expensify/App/issues/73656 -// eslint-disable-next-line @typescript-eslint/max-params -function explain( - childReport: OnyxEntry, - originalReport: OnyxEntry, - reportAction: OnyxEntry, - translate: LocalizedTranslate, - currentUserAccountID: number, - introSelected: OnyxEntry, - betas: OnyxEntry, - isSelfTourViewed: boolean | undefined, - delegateAccountID: number | undefined, - // The personal details of the explanation thread participants (the current user and the report action's actor). - participantsPersonalDetails: OnyxEntry, - timezone: Timezone = CONST.DEFAULT_TIME_ZONE, -) { +type ExplainParams = { + childReport: OnyxEntry; + originalReport: OnyxEntry; + reportAction: OnyxEntry; + translate: LocalizedTranslate; + currentUserAccountID: number; + introSelected: OnyxEntry; + betas: OnyxEntry; + conciergeChat: OnyxEntry; + isSelfTourViewed: boolean | undefined; + delegateAccountID: number | undefined; + /** The personal details of the explanation thread participants (the current user and the report action's actor). */ + participantsPersonalDetails: OnyxEntry; + timezone?: Timezone; +}; + +function explain({ + childReport, + originalReport, + reportAction, + translate, + currentUserAccountID, + introSelected, + betas, + conciergeChat, + isSelfTourViewed, + delegateAccountID, + participantsPersonalDetails, + timezone = CONST.DEFAULT_TIME_ZONE, +}: ExplainParams) { if (!originalReport?.reportID || !reportAction) { return; } // Check if explanation thread report already exists - const report = childReport ?? createChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, participantsPersonalDetails); + const report = + childReport ?? createChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, participantsPersonalDetails, conciergeChat); if (isSearchTopmostFullScreenRoute()) { Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: report.reportID, backTo: Navigation.getActiveRoute()})); @@ -3806,6 +3826,7 @@ type ToggleSubscribeToChildReportParams = { isSelfTourViewed: boolean | undefined; hasCompletedGuidedSetupFlow: boolean | undefined; betas: OnyxEntry; + conciergeChat: OnyxEntry; prevNotificationPreference: NotificationPreference | undefined; personalDetails: OnyxEntry; hasReportActions: boolean; @@ -3828,12 +3849,13 @@ function toggleSubscribeToChildReport({ isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, + conciergeChat, prevNotificationPreference, personalDetails, hasReportActions, }: ToggleSubscribeToChildReportParams) { if (childReportID) { - openReport({reportID: childReportID, introSelected, betas, isSelfTourViewed, hasCompletedGuidedSetupFlow, hasReportActions, currentUserAccountID}); + openReport({reportID: childReportID, introSelected, betas, isSelfTourViewed, hasCompletedGuidedSetupFlow, hasReportActions, currentUserAccountID, conciergeChat}); const parentReportActionID = parentReportAction.reportActionID; if (!prevNotificationPreference || isHiddenForCurrentUser(prevNotificationPreference)) { updateNotificationPreference( @@ -3880,6 +3902,7 @@ function toggleSubscribeToChildReport({ isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, + conciergeChat, hasReportActions: false, currentUserAccountID, }); diff --git a/src/pages/Share/ShareDetailsPage.tsx b/src/pages/Share/ShareDetailsPage.tsx index 970819d1ff29..103941183565 100644 --- a/src/pages/Share/ShareDetailsPage.tsx +++ b/src/pages/Share/ShareDetailsPage.tsx @@ -66,6 +66,7 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) { const [isDraftReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_DRAFT}${reportOrAccountID}`, {selector: isDraftReportSelector}); const [betas] = useOnyx(ONYXKEYS.BETAS); const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`); const delegateAccountID = useDelegateAccountID(); const reportAttributesDerived = useReportAttributes(); @@ -175,6 +176,7 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) { personalDetails, newReportObject: report, betas, + conciergeChat, hasReportActions: false, currentUserAccountID: personalDetail.accountID, }); diff --git a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx index 1d1d3080481c..15d22f4fff69 100755 --- a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -249,6 +249,7 @@ function BaseReportActionContextMenu({ const [guidedSetupAndTourStatus] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: guidedSetupAndTourStatusSelector}); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`); const personalDetails = usePersonalDetails(); const reportAttributes = useReportAttributes(); const delegateAccountID = useDelegateAccountID(); @@ -440,6 +441,7 @@ function BaseReportActionContextMenu({ bankAccountList, isOffline, conciergeReportID, + conciergeChat, delegateAccountID, reportAttributes, originalReportOfUnapprovedTransaction, diff --git a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx index 02cfc9413fa3..629c1f649d11 100644 --- a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx @@ -364,6 +364,7 @@ type ContextMenuActionPayload = { bankAccountList: OnyxEntry; isOffline: boolean; conciergeReportID: string | undefined; + conciergeChat: OnyxEntry; originalReportOfUnapprovedTransaction?: OnyxEntry; delegateAccountID: number | undefined; reportAttributes: ReportAttributesDerivedValue['reports'] | undefined; @@ -502,17 +503,27 @@ const ContextMenuActions: ContextMenuAction[] = [ } return !shouldDisableThread(reportAction, isThreadReportParentAction, isArchivedRoom); }, - onPress: (closePopover, {reportAction, childReport, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, personalDetails}) => { + onPress: (closePopover, {reportAction, childReport, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, personalDetails, conciergeChat}) => { const participantsPersonalDetails = getParticipantsPersonalDetails([currentUserAccountID, Number(reportAction.actorAccountID)], personalDetails); if (closePopover) { hideContextMenu(false, () => { KeyboardUtils.dismiss().then(() => { - navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, participantsPersonalDetails, isSelfTourViewed); + navigateToAndOpenChildReport( + childReport, + reportAction, + originalReport, + currentUserAccountID, + introSelected, + betas, + participantsPersonalDetails, + isSelfTourViewed, + conciergeChat, + ); }); }); return; } - navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, participantsPersonalDetails, isSelfTourViewed); + navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, participantsPersonalDetails, isSelfTourViewed, conciergeChat); }, getDescription: () => {}, sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.REPLY_IN_THREAD, @@ -548,7 +559,7 @@ const ContextMenuActions: ContextMenuAction[] = [ }, onPress: ( closePopover, - {reportAction, childReport, originalReport, translate, currentUserPersonalDetails, introSelected, betas, isSelfTourViewed, delegateAccountID, personalDetails}, + {reportAction, childReport, originalReport, translate, currentUserPersonalDetails, introSelected, betas, isSelfTourViewed, delegateAccountID, personalDetails, conciergeChat}, ) => { if (!originalReport?.reportID) { return; @@ -559,37 +570,39 @@ const ContextMenuActions: ContextMenuAction[] = [ if (closePopover) { hideContextMenu(false, () => { KeyboardUtils.dismiss().then(() => { - explain( + explain({ childReport, originalReport, reportAction, translate, - currentUserPersonalDetails.accountID, + currentUserAccountID: currentUserPersonalDetails.accountID, introSelected, betas, + conciergeChat, isSelfTourViewed, delegateAccountID, participantsPersonalDetails, - currentUserPersonalDetails?.timezone, - ); + timezone: currentUserPersonalDetails?.timezone, + }); }); }); return; } - explain( + explain({ childReport, originalReport, reportAction, translate, - currentUserPersonalDetails.accountID, + currentUserAccountID: currentUserPersonalDetails.accountID, introSelected, betas, + conciergeChat, isSelfTourViewed, delegateAccountID, participantsPersonalDetails, - currentUserPersonalDetails?.timezone, - ); + timezone: currentUserPersonalDetails?.timezone, + }); }, getDescription: () => {}, sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.EXPLAIN, @@ -620,12 +633,24 @@ const ContextMenuActions: ContextMenuAction[] = [ !isChronosReport, onPress: ( closePopover, - {reportID, reportActions, originalReportActions, originalReportID, reportAction, moneyRequestAction, introSelected, betas, childReportActions, currentUserAccountID}, + { + reportID, + reportActions, + originalReportActions, + originalReportID, + reportAction, + moneyRequestAction, + introSelected, + betas, + childReportActions, + currentUserAccountID, + conciergeChat, + }, ) => { if (isMoneyRequestAction(reportAction) || isMoneyRequestAction(moneyRequestAction)) { const editExpense = () => { const childReportID = reportAction?.childReportID; - openReport({reportID: childReportID, introSelected, betas, hasReportActions: !!childReportActions, currentUserAccountID}); + openReport({reportID: childReportID, introSelected, betas, hasReportActions: !!childReportActions, currentUserAccountID, conciergeChat}); Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(childReportID)); }; if (closePopover) { @@ -800,7 +825,7 @@ const ContextMenuActions: ContextMenuAction[] = [ }, onPress: ( closePopover, - {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, personalDetails, childReportActions}, + {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, personalDetails, childReportActions, conciergeChat}, ) => { const childReportNotificationPreference = getChildReportNotificationPreferenceReportUtils(reportAction); if (closePopover) { @@ -815,6 +840,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, + conciergeChat, prevNotificationPreference: childReportNotificationPreference, personalDetails, hasReportActions: !!childReportActions, @@ -833,6 +859,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, + conciergeChat, prevNotificationPreference: childReportNotificationPreference, personalDetails, hasReportActions: !!childReportActions, @@ -866,7 +893,7 @@ const ContextMenuActions: ContextMenuAction[] = [ }, onPress: ( closePopover, - {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, personalDetails, childReportActions}, + {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, personalDetails, childReportActions, conciergeChat}, ) => { const childReportNotificationPreference = getChildReportNotificationPreferenceReportUtils(reportAction); if (closePopover) { @@ -881,6 +908,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, + conciergeChat, prevNotificationPreference: childReportNotificationPreference, personalDetails, hasReportActions: !!childReportActions, @@ -899,6 +927,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, hasCompletedGuidedSetupFlow, betas, + conciergeChat, prevNotificationPreference: childReportNotificationPreference, personalDetails, hasReportActions: !!childReportActions, diff --git a/src/pages/inbox/report/ReportActionItemMessageWithExplain.tsx b/src/pages/inbox/report/ReportActionItemMessageWithExplain.tsx index 5abd088bfaca..e0ec3ce4b885 100644 --- a/src/pages/inbox/report/ReportActionItemMessageWithExplain.tsx +++ b/src/pages/inbox/report/ReportActionItemMessageWithExplain.tsx @@ -52,6 +52,8 @@ function ReportActionItemMessageWithExplain({message, action, childReport, origi const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); const [betas] = useOnyx(ONYXKEYS.BETAS); + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`); const delegateAccountID = useDelegateAccountID(); const personalDetails = usePersonalDetails(); @@ -62,19 +64,20 @@ function ReportActionItemMessageWithExplain({message, action, childReport, origi // Handle the special "Explain" link if (href.endsWith(CONST.CONCIERGE_EXPLAIN_LINK_PATH)) { const participantsPersonalDetails = getParticipantsPersonalDetails([personalDetail.accountID, Number(action?.actorAccountID)], personalDetails); - explain( + explain({ childReport, originalReport, - action, + reportAction: action, translate, - personalDetail.accountID, + currentUserAccountID: personalDetail.accountID, introSelected, betas, + conciergeChat, isSelfTourViewed, delegateAccountID, participantsPersonalDetails, - personalDetail?.timezone, - ); + timezone: personalDetail?.timezone, + }); return; } diff --git a/src/pages/inbox/report/ReportActionItemThread.tsx b/src/pages/inbox/report/ReportActionItemThread.tsx index ea41a7a54058..c10d85801ad5 100644 --- a/src/pages/inbox/report/ReportActionItemThread.tsx +++ b/src/pages/inbox/report/ReportActionItemThread.tsx @@ -50,6 +50,8 @@ function ReportActionItemThread({report, reportAction, isHovered, onSecondaryInt const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); const [betas] = useOnyx(ONYXKEYS.BETAS); + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const [conciergeChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${conciergeReportID}`); const personalDetails = usePersonalDetails(); const numberOfReplies = reportAction.childVisibleActionCount ?? 0; @@ -72,7 +74,17 @@ function ReportActionItemThread({report, reportAction, isHovered, onSecondaryInt { const participantsPersonalDetails = getParticipantsPersonalDetails([currentUserAccountID, Number(reportAction.actorAccountID)], personalDetails); - navigateToAndOpenChildReport(childReport, reportAction, report, currentUserAccountID, introSelected, betas, participantsPersonalDetails, isSelfTourViewed); + navigateToAndOpenChildReport( + childReport, + reportAction, + report, + currentUserAccountID, + introSelected, + betas, + participantsPersonalDetails, + isSelfTourViewed, + conciergeChat, + ); }} role={CONST.ROLE.BUTTON} accessibilityLabel={`${numberOfReplies} ${replyText}`} diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index 2b5d4e24030f..159263b46c66 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -5716,7 +5716,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -5735,12 +5735,38 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); }); + it('threads the conciergeChat report into the guided setup data sent with OpenReport', async () => { + // Given a signed-in user with onboarding still pending and an existing Concierge chat + const PARENT_REPORT = createRandomReport(1, undefined); + const PARENT_REPORT_ACTION: OnyxTypes.ReportAction = { + ...createRandomReportAction(REPORT_ACTION_ID), + reportActionID: '1', + actorAccountID: TEST_USER_ACCOUNT_ID, + }; + + await TestHelper.signInWithTestUser(TEST_USER_ACCOUNT_ID, TEST_USER_LOGIN); + await TestHelper.setPersonalDetails(TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID); + await Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: false}); + Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); + const conciergeChat: OnyxTypes.Report = {...createRandomReport(777, undefined), reportID: 'concierge-child-thread-1'}; + await waitForBatchedUpdates(); + + // When a new thread is created with the conciergeChat threaded through + const introSelected: OnyxTypes.IntroSelected = {choice: CONST.ONBOARDING_CHOICES.SUBMIT, isInviteOnboardingComplete: false}; + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, introSelected, undefined, undefined, undefined, conciergeChat); + await waitForBatchedUpdates(); + + // Then the optimistic onboarding actions target the threaded Concierge chat, not the deprecated module-level lookup + const conciergeReportActions = await getOnyxValue(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${conciergeChat.reportID}`); + expect(Object.keys(conciergeReportActions ?? {}).length).toBeGreaterThan(0); + }); + it('should work with empty parent report action', async () => { const PARENT_REPORT = createRandomReport(1, undefined); const EXISTING_CHILD_REPORT = createRandomReport(2, undefined); @@ -5759,6 +5785,7 @@ describe('actions/Report', () => { undefined, undefined, undefined, + undefined, ); await waitForBatchedUpdates(); @@ -5778,7 +5805,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); @@ -5797,7 +5824,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); // Verify navigation happened with the new thread report @@ -5822,7 +5849,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, undefined, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, undefined, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -5842,7 +5869,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, testBetas, undefined, undefined); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, testBetas, undefined, undefined, undefined); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -5876,7 +5903,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, introSelected, undefined, undefined, isSelfTourViewed); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, introSelected, undefined, undefined, isSelfTourViewed, undefined); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -5913,7 +5940,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -5947,37 +5974,39 @@ describe('actions/Report', () => { actorAccountID: TEST_USER_ACCOUNT_ID, }; - const result = Report.explain( - undefined, - undefined, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - INTRO_SELECTED, - undefined, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + const result = Report.explain({ + childReport: undefined, + originalReport: undefined, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); expect(result).toBeUndefined(); }); it('should return early if reportAction is not provided', () => { - const result = Report.explain( - undefined, - undefined, - undefined, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - INTRO_SELECTED, - undefined, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + const result = Report.explain({ + childReport: undefined, + originalReport: undefined, + reportAction: undefined, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); expect(result).toBeUndefined(); }); @@ -5996,19 +6025,20 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${CHILD_REPORT_ID}`, EXISTING_CHILD_REPORT); await waitForBatchedUpdates(); - Report.explain( - EXISTING_CHILD_REPORT, - PARENT_REPORT, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - INTRO_SELECTED, - undefined, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + Report.explain({ + childReport: EXISTING_CHILD_REPORT, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -6027,19 +6057,20 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.explain( - undefined, - PARENT_REPORT, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - INTRO_SELECTED, - undefined, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + Report.explain({ + childReport: undefined, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); @@ -6063,7 +6094,19 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${CHILD_REPORT_ID}`, EXISTING_CHILD_REPORT); await waitForBatchedUpdates(); - Report.explain(EXISTING_CHILD_REPORT, PARENT_REPORT, REPORT_ACTION, TestHelper.translateLocal, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); + Report.explain({ + childReport: EXISTING_CHILD_REPORT, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + }); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -6083,19 +6126,20 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${CHILD_REPORT_ID}`, EXISTING_CHILD_REPORT); await waitForBatchedUpdates(); - Report.explain( - EXISTING_CHILD_REPORT, - PARENT_REPORT, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - undefined, - undefined, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + Report.explain({ + childReport: EXISTING_CHILD_REPORT, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: undefined, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -6115,19 +6159,20 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.explain( - undefined, - PARENT_REPORT, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - INTRO_SELECTED, - testBetas, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + Report.explain({ + childReport: undefined, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: testBetas, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -6161,19 +6206,20 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.explain( - undefined, - PARENT_REPORT, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, + Report.explain({ + childReport: undefined, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, introSelected, - undefined, + betas: undefined, + conciergeChat: undefined, isSelfTourViewed, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -6210,19 +6256,20 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${CHILD_REPORT_ID}`, EXISTING_CHILD_REPORT); await waitForBatchedUpdates(); - Report.explain( - EXISTING_CHILD_REPORT, - PARENT_REPORT, - REPORT_ACTION, - TestHelper.translateLocal, - TEST_USER_ACCOUNT_ID, - INTRO_SELECTED, - undefined, - undefined, - undefined, - undefined, - CONST.DEFAULT_TIME_ZONE, - ); + Report.explain({ + childReport: EXISTING_CHILD_REPORT, + originalReport: PARENT_REPORT, + reportAction: REPORT_ACTION, + translate: TestHelper.translateLocal, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + introSelected: INTRO_SELECTED, + betas: undefined, + conciergeChat: undefined, + isSelfTourViewed: undefined, + delegateAccountID: undefined, + participantsPersonalDetails: undefined, + timezone: CONST.DEFAULT_TIME_ZONE, + }); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -6260,6 +6307,7 @@ describe('actions/Report', () => { isSelfTourViewed: false, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: 'hidden', personalDetails: undefined, hasReportActions: false, @@ -6290,6 +6338,7 @@ describe('actions/Report', () => { isSelfTourViewed: false, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: undefined, personalDetails: undefined, hasReportActions: false, @@ -6320,6 +6369,7 @@ describe('actions/Report', () => { isSelfTourViewed: true, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: 'hidden', personalDetails: undefined, hasReportActions: false, @@ -6350,6 +6400,7 @@ describe('actions/Report', () => { isSelfTourViewed: true, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, personalDetails: undefined, hasReportActions: false, @@ -6380,6 +6431,7 @@ describe('actions/Report', () => { isSelfTourViewed: true, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: undefined, personalDetails: undefined, hasReportActions: false, @@ -6410,6 +6462,7 @@ describe('actions/Report', () => { isSelfTourViewed: false, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: undefined, personalDetails: undefined, hasReportActions: false, @@ -6440,6 +6493,7 @@ describe('actions/Report', () => { isSelfTourViewed: true, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: 'hidden', personalDetails: undefined, hasReportActions: false, @@ -6470,6 +6524,7 @@ describe('actions/Report', () => { isSelfTourViewed: false, hasCompletedGuidedSetupFlow: undefined, betas: undefined, + conciergeChat: undefined, prevNotificationPreference: undefined, personalDetails: undefined, hasReportActions: false, @@ -6501,6 +6556,7 @@ describe('actions/Report', () => { isSelfTourViewed: undefined, hasCompletedGuidedSetupFlow: undefined, betas: testBetas, + conciergeChat: undefined, prevNotificationPreference: 'hidden', personalDetails: undefined, hasReportActions: false, @@ -6532,6 +6588,7 @@ describe('actions/Report', () => { isSelfTourViewed: undefined, hasCompletedGuidedSetupFlow: undefined, betas: testBetas, + conciergeChat: undefined, prevNotificationPreference: undefined, personalDetails: undefined, hasReportActions: false, From 22eabcd9551186d9f059cd2c9571568d58b6f2c1 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Tue, 1 Sep 2026 22:57:21 +0700 Subject: [PATCH 2/2] Fix: add missing parameter to navigateToAndOpenChildReport function in ReportTest --- tests/actions/ReportTest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index 62485f6c7028..86dddc418c5f 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -5745,7 +5745,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith( @@ -5768,7 +5768,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(