diff --git a/src/components/ReportActionItem/MoneyRequestReceiptView.tsx b/src/components/ReportActionItem/MoneyRequestReceiptView.tsx index 8244aefee4e9..a919d6f9597c 100644 --- a/src/components/ReportActionItem/MoneyRequestReceiptView.tsx +++ b/src/components/ReportActionItem/MoneyRequestReceiptView.tsx @@ -1,5 +1,6 @@ import {useRoute} from '@react-navigation/native'; import {hasSeenTourSelector} from '@selectors/Onboarding'; +import {conciergePersonalDetailSelector, personalDetailByAccountIDSelector} from '@selectors/PersonalDetails'; import mapValues from 'lodash/mapValues'; import React, {useEffect, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; @@ -136,6 +137,11 @@ function MoneyRequestReceiptView({ const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); const [betas] = useOnyx(ONYXKEYS.BETAS); + const [conciergePersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: conciergePersonalDetailSelector}); + const reportOwnerSelector = useMemo(() => personalDetailByAccountIDSelector(report?.ownerAccountID), [report?.ownerAccountID]); + const [reportOwnerPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: reportOwnerSelector}, [reportOwnerSelector]); + const chatReportOwnerSelector = useMemo(() => personalDetailByAccountIDSelector(chatReport?.ownerAccountID), [chatReport?.ownerAccountID]); + const [chatReportOwnerPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: chatReportOwnerSelector}, [chatReportOwnerSelector]); const delegateAccountID = useDelegateAccountID(); const [isLoading, setIsLoading] = useState(true); @@ -164,7 +170,8 @@ function MoneyRequestReceiptView({ const didReceiptScanSucceed = hasReceipt && didReceiptScanSucceedTransactionUtils(transaction); const isInvoice = isInvoiceReport(moneyRequestReport); const isChatReportArchived = useReportIsArchived(moneyRequestReport?.chatReportID); - const {login: currentUserLogin, accountID: currentUserAccountID, timezone: currentUserTimezone} = useCurrentUserPersonalDetails(); + const currentUserPersonalDetail = useCurrentUserPersonalDetails(); + const {login: currentUserLogin, accountID: currentUserAccountID, timezone: currentUserTimezone} = currentUserPersonalDetail; const theme = useTheme(); const ancestors = useAncestors(report); const {hovered, bind: hoverBind} = useHover(); @@ -394,7 +401,19 @@ function MoneyRequestReceiptView({ } if (transaction?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { if (chatReport?.reportID && getCreationReportErrors(chatReport)) { - navigateToConciergeChatAndDeleteReport(chatReport.reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, betas, true, true); + navigateToConciergeChatAndDeleteReport( + chatReport.reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + betas, + chatReportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, + true, + true, + ); return; } if (parentReportAction) { @@ -433,7 +452,19 @@ function MoneyRequestReceiptView({ if (isInNarrowPaneModal) { Navigation.goBack(); } - navigateToConciergeChatAndDeleteReport(report.reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, betas, true, true); + navigateToConciergeChatAndDeleteReport( + report.reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + betas, + reportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, + true, + true, + ); } }; diff --git a/src/components/ReportActionItem/TaskView.tsx b/src/components/ReportActionItem/TaskView.tsx index 399b40fc4732..3d59492ae481 100644 --- a/src/components/ReportActionItem/TaskView.tsx +++ b/src/components/ReportActionItem/TaskView.tsx @@ -117,7 +117,19 @@ function TaskView({report, parentReport, action}: TaskViewProps) { clearTaskErrors(report, conciergeReportID, accountID, introSelected, betas, isSelfTourViewed)} + onClose={() => + clearTaskErrors( + report, + conciergeReportID, + accountID, + introSelected, + betas, + isSelfTourViewed, + report?.ownerAccountID ? (personalDetails?.[report.ownerAccountID] ?? undefined) : undefined, + currentUserPersonalDetails, + (personalDetails ? Object.values(personalDetails).find((detail) => detail?.login === CONST.EMAIL.CONCIERGE) : undefined) ?? undefined, + ) + } errorRowStyles={styles.ph5} > diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index 41afffa75cd1..af7fe743e2c1 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -232,6 +232,7 @@ import type { VisibleReportActionsDerivedValue, } from '@src/types/onyx'; import type {Decision} from '@src/types/onyx/OriginalMessage'; +import type PersonalDetails from '@src/types/onyx/PersonalDetails'; import type {CurrentUserPersonalDetails, Timezone} from '@src/types/onyx/PersonalDetails'; import type {ConnectionName} from '@src/types/onyx/Policy'; import type {NotificationPreference, Participants, Participant as ReportParticipant, RoomVisibility, WriteCapability} from '@src/types/onyx/Report'; @@ -482,6 +483,20 @@ Onyx.connect({ }, }); +/** + * Builds a partial PersonalDetailsList containing only the records passed in. Skips entries with no accountID. + */ +function buildPersonalDetailsList(details: Array>): PersonalDetailsList { + const result: PersonalDetailsList = {}; + for (const detail of details) { + if (detail?.accountID == null) { + continue; + } + result[detail.accountID] = detail; + } + return result; +} + const typingWatchTimers: Record = {}; // Track subscriptions to conciergeReasoning Pusher events to avoid duplicates. @@ -2344,8 +2359,7 @@ function navigateToAndOpenReportWithAccountIDs( introSelected: OnyxEntry, isSelfTourViewed: boolean | undefined, betas: OnyxEntry, - // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails?: OnyxEntry, + personalDetails: OnyxEntry, shouldRevalidateExistingChat = false, ) { const participants = participantAccountIDs.map((accountID): ParticipantInfo => { @@ -2372,8 +2386,7 @@ function navigateToAndOpenReportWithAccountIDs( newReportObject: fallbackChat, parentReportActionID: '0', participants, - // TODO: allPersonalDetails fallback should be removed in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails: personalDetails ?? allPersonalDetails, + personalDetails, betas, }); @@ -2431,9 +2444,8 @@ function navigateToAndOpenChildReport( currentUserAccountID: number, introSelected: OnyxEntry, betas: OnyxEntry, + personalDetails: OnyxEntry, isSelfTourViewed: boolean | undefined, - // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails?: OnyxEntry, ) { const report = childReport ?? createChildReport(childReport, parentReportAction, parentReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, personalDetails); @@ -3428,9 +3440,8 @@ function toggleSubscribeToChildReport( introSelected: OnyxEntry, isSelfTourViewed: boolean | undefined, betas: OnyxEntry, - prevNotificationPreference?: NotificationPreference, - // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails?: OnyxEntry, + prevNotificationPreference: NotificationPreference | undefined, + personalDetails: OnyxEntry, ) { if (childReportID) { openReport({reportID: childReportID, introSelected, betas, isSelfTourViewed}); @@ -3474,8 +3485,7 @@ function toggleSubscribeToChildReport( reportID: newChat.reportID, introSelected, participants, - // TODO: allPersonalDetails fallback should be removed in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails: personalDetails ?? allPersonalDetails, + personalDetails, newReportObject: newChat, parentReportActionID: parentReportAction.reportActionID, isSelfTourViewed, @@ -4362,6 +4372,7 @@ function deleteReport(reportID: string | undefined, shouldDeleteChildReports = f /** * @param reportID The reportID of the policy report (workspace room) */ +// eslint-disable-next-line @typescript-eslint/max-params function navigateToConciergeChatAndDeleteReport( reportID: string | undefined, conciergeReportID: string | undefined, @@ -4369,10 +4380,11 @@ function navigateToConciergeChatAndDeleteReport( introSelected: OnyxEntry, isSelfTourViewed: boolean | undefined, betas: OnyxEntry, + reportOwnerPersonalDetail: OnyxEntry, + currentUserPersonalDetail: OnyxEntry, + conciergePersonalDetail: OnyxEntry, shouldPopToTop = false, shouldDeleteChildReports = false, - // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails?: OnyxEntry, ) { // Dismiss the current report screen and replace it with Concierge Chat if (shouldPopToTop) { @@ -4380,8 +4392,9 @@ function navigateToConciergeChatAndDeleteReport( } else { Navigation.goBack(); } - // TODO: allPersonalDetails fallback should be removed in follow-up PRs https://github.com/Expensify/App/issues/73656 - navigateToConciergeChat(conciergeReportID, introSelected, currentUserAccountID, isSelfTourViewed, betas, false, undefined, undefined, undefined, personalDetails ?? allPersonalDetails); + const personalDetails = buildPersonalDetailsList([reportOwnerPersonalDetail, currentUserPersonalDetail, conciergePersonalDetail]); + navigateToConciergeChat(conciergeReportID, introSelected, currentUserAccountID, isSelfTourViewed, betas, false, undefined, undefined, undefined, personalDetails); + // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { deleteReport(reportID, shouldDeleteChildReports); }); @@ -4394,6 +4407,9 @@ function clearCreateChatError( currentUserAccountID: number, betas: OnyxEntry, isSelfTourViewed: boolean | undefined, + reportOwnerPersonalDetail: OnyxEntry, + currentUserPersonalDetail: OnyxEntry, + conciergePersonalDetail: OnyxEntry, ) { const metaData = getReportMetadata(report?.reportID); const isOptimisticReport = metaData?.isOptimisticReport; @@ -4402,7 +4418,19 @@ function clearCreateChatError( return; } - navigateToConciergeChatAndDeleteReport(report?.reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, betas, undefined, true); + navigateToConciergeChatAndDeleteReport( + report?.reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + betas, + reportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, + undefined, + true, + ); } /** diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index 81b8dde020f1..c3ae5ed78e0d 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -26,6 +26,7 @@ import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; import type {Icon} from '@src/types/onyx/OnyxCommon'; +import type PersonalDetails from '@src/types/onyx/PersonalDetails'; import type {ReportActions} from '@src/types/onyx/ReportAction'; import type ReportAction from '@src/types/onyx/ReportAction'; import type {OnyxData} from '@src/types/onyx/Request'; @@ -1432,6 +1433,9 @@ function clearTaskErrors( introSelected: OnyxEntry, betas: OnyxEntry, isSelfTourViewed: boolean | undefined, + reportOwnerPersonalDetail: OnyxEntry, + currentUserPersonalDetail: OnyxEntry, + conciergePersonalDetail: OnyxEntry, ) { const reportID = report?.reportID; if (!reportID) { @@ -1442,7 +1446,19 @@ function clearTaskErrors( if (report?.pendingFields?.createChat === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`, report.parentReportActionID ? {[report.parentReportActionID]: null} : {}); - navigateToConciergeChatAndDeleteReport(reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, betas); + navigateToConciergeChatAndDeleteReport( + reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + betas, + reportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, + undefined, + undefined, + ); return; } diff --git a/src/pages/Debug/Report/DebugReportPage.tsx b/src/pages/Debug/Report/DebugReportPage.tsx index be2516a2b0bc..de6fa1130a0f 100644 --- a/src/pages/Debug/Report/DebugReportPage.tsx +++ b/src/pages/Debug/Report/DebugReportPage.tsx @@ -1,4 +1,5 @@ import {hasSeenTourSelector} from '@selectors/Onboarding'; +import {conciergePersonalDetailSelector, personalDetailByAccountIDSelector} from '@selectors/PersonalDetails'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -76,7 +77,11 @@ function DebugReportPage({ const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); - const {accountID: currentUserAccountID, login: currentUserLogin} = useCurrentUserPersonalDetails(); + const currentUserPersonalDetail = useCurrentUserPersonalDetails(); + const {accountID: currentUserAccountID, login: currentUserLogin} = currentUserPersonalDetail; + const [conciergePersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: conciergePersonalDetailSelector}); + const reportOwnerSelector = useMemo(() => personalDetailByAccountIDSelector(report?.ownerAccountID), [report?.ownerAccountID]); + const [reportOwnerPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: reportOwnerSelector}, [reportOwnerSelector]); const transactionID = DebugUtils.getTransactionID(report, reportActions); const isReportArchived = useReportIsArchived(reportID); @@ -185,7 +190,19 @@ function DebugReportPage({ Debug.setDebugData(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, data); }} onDelete={() => { - navigateToConciergeChatAndDeleteReport(reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, betas, true, true); + navigateToConciergeChatAndDeleteReport( + reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + betas, + reportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, + true, + true, + ); }} validate={DebugUtils.validateReportDraftProperty} > @@ -251,6 +268,9 @@ function DebugReportPage({ introSelected, isSelfTourViewed, betas, + reportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, ], ); diff --git a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx index 112b44573174..f3dafefa8052 100755 --- a/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/inbox/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -12,7 +12,7 @@ import CompactMenuContext from '@components/CompactMenuContext'; import ContextMenuItem from '@components/ContextMenuItem'; import {useDelegateNoAccessActions, useDelegateNoAccessState} from '@components/DelegateNoAccessModalProvider'; import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal'; -import {useSession} from '@components/OnyxListItemProvider'; +import {usePersonalDetails, useSession} from '@components/OnyxListItemProvider'; import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDelegateAccountID from '@hooks/useDelegateAccountID'; @@ -245,6 +245,7 @@ function BaseReportActionContextMenu({ const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); + const personalDetails = usePersonalDetails(); const reportAttributes = useReportAttributes(); const delegateAccountID = useDelegateAccountID(); @@ -395,6 +396,7 @@ function BaseReportActionContextMenu({ interceptAnonymousUser, openOverflowMenu, setIsEmojiPickerActive, + personalDetails, isHarvestReport, moneyRequestAction, card, diff --git a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx index e06d87b3234e..cb715d9a727c 100644 --- a/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx @@ -206,6 +206,7 @@ import type { Download as DownloadOnyx, IntroSelected, OnyxInputOrEntry, + PersonalDetailsList, Policy, PolicyTagLists, ReportAction, @@ -301,6 +302,7 @@ type ContextMenuActionPayload = { introSelected: OnyxEntry; isSelfTourViewed: boolean | undefined; betas: OnyxEntry; + personalDetails: OnyxEntry; isDelegateAccessRestricted?: boolean; showDelegateNoAccessModal?: () => void; currentUserPersonalDetails: ReturnType; @@ -445,16 +447,16 @@ const ContextMenuActions: ContextMenuAction[] = [ } return !shouldDisableThread(reportAction, isThreadReportParentAction, isArchivedRoom); }, - onPress: (closePopover, {reportAction, childReport, originalReport, currentUserAccountID, introSelected, isSelfTourViewed, betas}) => { + onPress: (closePopover, {reportAction, childReport, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed, personalDetails}) => { if (closePopover) { hideContextMenu(false, () => { KeyboardUtils.dismiss().then(() => { - navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed); + navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, personalDetails, isSelfTourViewed); }); }); return; } - navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, isSelfTourViewed); + navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas, personalDetails, isSelfTourViewed); }, getDescription: () => {}, sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.REPLY_IN_THREAD, @@ -668,7 +670,7 @@ const ContextMenuActions: ContextMenuAction[] = [ (shouldDisplayThreadReplies || (!isDeletedAction && !isArchivedRoom)) ); }, - onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, betas}) => { + onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, betas, personalDetails}) => { const childReportNotificationPreference = getChildReportNotificationPreferenceReportUtils(reportAction); if (closePopover) { hideContextMenu(false, () => { @@ -682,6 +684,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, betas, childReportNotificationPreference, + personalDetails, ); }); return; @@ -697,6 +700,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, betas, childReportNotificationPreference, + personalDetails, ); }, getDescription: () => {}, @@ -725,7 +729,7 @@ const ContextMenuActions: ContextMenuAction[] = [ (shouldDisplayThreadReplies || (!isDeletedAction && !isArchivedRoom)) ); }, - onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, betas}) => { + onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected, isSelfTourViewed, betas, personalDetails}) => { const childReportNotificationPreference = getChildReportNotificationPreferenceReportUtils(reportAction); if (closePopover) { hideContextMenu(false, () => { @@ -739,6 +743,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, betas, childReportNotificationPreference, + personalDetails, ); }); return; @@ -754,6 +759,7 @@ const ContextMenuActions: ContextMenuAction[] = [ isSelfTourViewed, betas, childReportNotificationPreference, + personalDetails, ); }, getDescription: () => {}, diff --git a/src/pages/inbox/report/ReportActionItemCreated.tsx b/src/pages/inbox/report/ReportActionItemCreated.tsx index 8414b3f01b3d..51d5fa790ee9 100644 --- a/src/pages/inbox/report/ReportActionItemCreated.tsx +++ b/src/pages/inbox/report/ReportActionItemCreated.tsx @@ -1,5 +1,6 @@ import {hasSeenTourSelector} from '@selectors/Onboarding'; -import React, {memo} from 'react'; +import {conciergePersonalDetailSelector, personalDetailByAccountIDSelector} from '@selectors/PersonalDetails'; +import React, {memo, useMemo} from 'react'; import {View} from 'react-native'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; @@ -37,7 +38,11 @@ function ReportActionItemCreated({reportID, policyID}: ReportActionItemCreatedPr const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [betas] = useOnyx(ONYXKEYS.BETAS); const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); - const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); + const currentUserPersonalDetail = useCurrentUserPersonalDetails(); + const {accountID: currentUserAccountID} = currentUserPersonalDetail; + const [conciergePersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: conciergePersonalDetailSelector}); + const reportOwnerSelector = useMemo(() => personalDetailByAccountIDSelector(report?.ownerAccountID), [report?.ownerAccountID]); + const [reportOwnerPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: reportOwnerSelector}, [reportOwnerSelector]); if (!isChatReport(report)) { return null; @@ -50,7 +55,19 @@ function ReportActionItemCreated({reportID, policyID}: ReportActionItemCreatedPr pendingAction={report?.pendingFields?.addWorkspaceRoom ?? report?.pendingFields?.createChat} errors={report?.errorFields?.addWorkspaceRoom ?? report?.errorFields?.createChat} errorRowStyles={[styles.ml10, styles.mr2]} - onClose={() => clearCreateChatError(report, conciergeReportID, introSelected, currentUserAccountID, betas, isSelfTourViewed)} + onClose={() => + clearCreateChatError( + report, + conciergeReportID, + introSelected, + currentUserAccountID, + betas, + isSelfTourViewed, + reportOwnerPersonalDetail, + currentUserPersonalDetail, + conciergePersonalDetail, + ) + } > {/* hasDeferredWriteForReport is non-reactive (reads a module-level Map, not tracked by React). diff --git a/src/pages/inbox/report/ReportActionItemParentAction.tsx b/src/pages/inbox/report/ReportActionItemParentAction.tsx index 291007cc1710..991cd6485895 100644 --- a/src/pages/inbox/report/ReportActionItemParentAction.tsx +++ b/src/pages/inbox/report/ReportActionItemParentAction.tsx @@ -19,6 +19,7 @@ import { shouldExcludeAncestorReportAction, } from '@libs/ReportUtils'; import {navigateToConciergeChatAndDeleteReport} from '@userActions/Report'; +import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {PersonalDetailsList, Report, ReportAction, ReportNameValuePairs, Transaction} from '@src/types/onyx'; import AnimatedEmptyStateBackground from './AnimatedEmptyStateBackground'; @@ -92,7 +93,9 @@ function ReportActionItemParentAction({ const {isInNarrowPaneModal} = useResponsiveLayout(); const transactionID = isMoneyRequestAction(action) && getOriginalMessage(action)?.IOUTransactionID; const [allBetas] = useOnyx(ONYXKEYS.BETAS); - const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); + const currentUserPersonalDetail = useCurrentUserPersonalDetails(); + const {accountID: currentUserAccountID} = currentUserPersonalDetail; + const conciergePersonalDetail = personalDetails ? Object.values(personalDetails).find((detail) => detail?.login === CONST.EMAIL.CONCIERGE) : undefined; const getLinkedTransactionRouteError = useCallback((transaction: OnyxEntry) => { return transaction?.errorFields?.route; @@ -136,7 +139,21 @@ function ReportActionItemParentAction({ report?.errorFields?.createChatThread ?? (report?.errorFields?.createChat ? getMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage') : null) } errorRowStyles={[styles.ml10, styles.mr2]} - onClose={() => navigateToConciergeChatAndDeleteReport(report?.reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, allBetas, undefined, true)} + onClose={() => + navigateToConciergeChatAndDeleteReport( + report?.reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + allBetas, + report?.ownerAccountID ? (personalDetails?.[report.ownerAccountID] ?? undefined) : undefined, + currentUserPersonalDetail, + conciergePersonalDetail ?? undefined, + undefined, + true, + ) + } > {ancestors.map((ancestor) => { const {report: ancestorReport, reportAction: ancestorReportAction} = ancestor; @@ -152,7 +169,19 @@ function ReportActionItemParentAction({ errors={ancestorReport?.errorFields?.addWorkspaceRoom ?? ancestorReport?.errorFields?.createChat} errorRowStyles={[styles.ml10, styles.mr2]} onClose={() => - navigateToConciergeChatAndDeleteReport(ancestorReport.reportID, conciergeReportID, currentUserAccountID, introSelected, isSelfTourViewed, allBetas) + navigateToConciergeChatAndDeleteReport( + ancestorReport.reportID, + conciergeReportID, + currentUserAccountID, + introSelected, + isSelfTourViewed, + allBetas, + ancestorReport.ownerAccountID ? (personalDetails?.[ancestorReport.ownerAccountID] ?? undefined) : undefined, + currentUserPersonalDetail, + conciergePersonalDetail ?? undefined, + undefined, + undefined, + ) } > {shouldDisplayThreadDivider && ( diff --git a/src/pages/inbox/report/ReportActionItemThread.tsx b/src/pages/inbox/report/ReportActionItemThread.tsx index 81c54dd1da9c..401d34946554 100644 --- a/src/pages/inbox/report/ReportActionItemThread.tsx +++ b/src/pages/inbox/report/ReportActionItemThread.tsx @@ -3,6 +3,7 @@ import React from 'react'; import type {GestureResponderEvent} from 'react-native'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; +import {usePersonalDetails} from '@components/OnyxListItemProvider'; import PressableWithSecondaryInteraction from '@components/PressableWithSecondaryInteraction'; import ReportActionAvatars from '@components/ReportActionAvatars'; import Text from '@components/Text'; @@ -49,6 +50,7 @@ function ReportActionItemThread({numberOfReplies, accountIDs, mostRecentReply, r const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); const [betas] = useOnyx(ONYXKEYS.BETAS); + const personalDetails = usePersonalDetails(); const numberOfRepliesText = numberOfReplies > CONST.MAX_THREAD_REPLIES_PREVIEW ? `${CONST.MAX_THREAD_REPLIES_PREVIEW}+` : `${numberOfReplies}`; const replyText = numberOfReplies === 1 ? translate('threads.reply') : translate('threads.replies'); @@ -59,7 +61,7 @@ function ReportActionItemThread({numberOfReplies, accountIDs, mostRecentReply, r { - navigateToAndOpenChildReport(childReport, reportAction, report, currentUserAccountID, introSelected, betas, isSelfTourViewed); + navigateToAndOpenChildReport(childReport, reportAction, report, currentUserAccountID, introSelected, betas, personalDetails, isSelfTourViewed); }} role={CONST.ROLE.BUTTON} accessibilityLabel={`${numberOfReplies} ${replyText}`} diff --git a/src/pages/settings/HelpPage/HelpPage.tsx b/src/pages/settings/HelpPage/HelpPage.tsx index bab8e0f743d8..1a1cc380d5bd 100644 --- a/src/pages/settings/HelpPage/HelpPage.tsx +++ b/src/pages/settings/HelpPage/HelpPage.tsx @@ -61,7 +61,7 @@ function HelpPage() { description: translate('initialSettingsPage.helpPage.accountManagerDescription'), icon: accountManagerDetails.avatar, iconType: CONST.ICON_TYPE_AVATAR, - onPress: () => navigateToAndOpenReportWithAccountIDs([accountManagerDetails.accountID], currentUserAccountID, introSelected, isSelfTourViewed, betas), + onPress: () => navigateToAndOpenReportWithAccountIDs([accountManagerDetails.accountID], currentUserAccountID, introSelected, isSelfTourViewed, betas, personalDetails), shouldShowRightIcon: true, wrapperStyle: [styles.sectionMenuItemTopDescription], sentryLabel: CONST.SENTRY_LABEL.SETTINGS_HELP.ACCOUNT_MANAGER, @@ -76,7 +76,7 @@ function HelpPage() { description: translate('initialSettingsPage.helpPage.partnerManagerDescription'), icon: partnerManagerDetails.avatar, iconType: CONST.ICON_TYPE_AVATAR, - onPress: () => navigateToAndOpenReportWithAccountIDs([partnerManagerDetails.accountID], currentUserAccountID, introSelected, isSelfTourViewed, betas), + onPress: () => navigateToAndOpenReportWithAccountIDs([partnerManagerDetails.accountID], currentUserAccountID, introSelected, isSelfTourViewed, betas, personalDetails), shouldShowRightIcon: true, wrapperStyle: [styles.sectionMenuItemTopDescription], sentryLabel: CONST.SENTRY_LABEL.SETTINGS_HELP.PARTNER_MANAGER, @@ -91,7 +91,7 @@ function HelpPage() { description: translate('initialSettingsPage.helpPage.guideDescription'), icon: guideDetails.avatar, iconType: CONST.ICON_TYPE_AVATAR, - onPress: () => navigateToAndOpenReportWithAccountIDs([guideDetails.accountID], currentUserAccountID, introSelected, isSelfTourViewed, betas), + onPress: () => navigateToAndOpenReportWithAccountIDs([guideDetails.accountID], currentUserAccountID, introSelected, isSelfTourViewed, betas, personalDetails), shouldShowRightIcon: true, wrapperStyle: [styles.sectionMenuItemTopDescription], sentryLabel: CONST.SENTRY_LABEL.SETTINGS_HELP.GUIDE, diff --git a/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx b/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx index fb20007441c1..f543716e3bfd 100644 --- a/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx +++ b/src/pages/workspace/workflows/WorkspaceWorkflowsPayerPage.tsx @@ -360,7 +360,7 @@ function WorkspaceWorkflowsPayerPage({route, policy, personalDetails, isLoadingR return; } setShowErrorModal(false); - navigateToAndOpenReportWithAccountIDs([policy.ownerAccountID], currentUserPersonalDetails.accountID, introSelected, isSelfTourViewed, betas); + navigateToAndOpenReportWithAccountIDs([policy.ownerAccountID], currentUserPersonalDetails.accountID, introSelected, isSelfTourViewed, betas, personalDetails); }} html={translate('workflowsPayerPage.shareBankAccount.errorDescription', { admin: selectedPayerDetails?.displayName ?? '', diff --git a/src/selectors/PersonalDetails.ts b/src/selectors/PersonalDetails.ts index 4d1713da063e..3fbae1fe6aa3 100644 --- a/src/selectors/PersonalDetails.ts +++ b/src/selectors/PersonalDetails.ts @@ -1,11 +1,19 @@ import type {OnyxEntry} from 'react-native-onyx'; import CONST from '@src/CONST'; import type {PersonalDetailsList, Report} from '@src/types/onyx'; +import type PersonalDetails from '@src/types/onyx/PersonalDetails'; const personalDetailsSelector = (accountID: number) => (personalDetailsList: OnyxEntry) => personalDetailsList?.[accountID]; const personalDetailsLoginSelector = (accountID: number) => (personalDetailsList: OnyxEntry) => personalDetailsList?.[accountID]?.login; +const personalDetailByAccountIDSelector = + (accountID: number | undefined) => + (personalDetailsList: OnyxEntry): OnyxEntry => + accountID ? (personalDetailsList?.[accountID] ?? undefined) : undefined; + +const conciergePersonalDetailSelector = personalDetailByAccountIDSelector(CONST.ACCOUNT_ID.CONCIERGE); + const accountIDToLoginSelector = (reportsToArchive: Report[]) => (personalDetailsList: OnyxEntry) => { const map: Record = {}; for (const report of reportsToArchive) { @@ -17,4 +25,4 @@ const accountIDToLoginSelector = (reportsToArchive: Report[]) => (personalDetail return map; }; -export {personalDetailsSelector, personalDetailsLoginSelector, accountIDToLoginSelector}; +export {personalDetailsSelector, personalDetailsLoginSelector, personalDetailByAccountIDSelector, conciergePersonalDetailSelector, accountIDToLoginSelector}; diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index 082a76a72004..054190acda02 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -329,7 +329,17 @@ describe('actions/Report', () => { return waitForBatchedUpdates() .then(() => { - Report.clearCreateChatError(REPORT, CONCIERGE_REPORT_ID, {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, TEST_USER_ACCOUNT_ID, undefined, false); + Report.clearCreateChatError( + REPORT, + CONCIERGE_REPORT_ID, + {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, + TEST_USER_ACCOUNT_ID, + undefined, + false, + undefined, + undefined, + undefined, + ); return waitForBatchedUpdates(); }) .then( @@ -362,7 +372,7 @@ describe('actions/Report', () => { return waitForBatchedUpdates() .then(() => { - Report.clearCreateChatError(REPORT, CONCIERGE_REPORT_ID, INTRO_SELECTED, TEST_USER_ACCOUNT_ID, undefined, false); + Report.clearCreateChatError(REPORT, CONCIERGE_REPORT_ID, INTRO_SELECTED, TEST_USER_ACCOUNT_ID, undefined, false, undefined, undefined, undefined); return waitForBatchedUpdates(); }) .then( @@ -394,7 +404,7 @@ describe('actions/Report', () => { return waitForBatchedUpdates() .then(() => { - Report.clearCreateChatError(REPORT, CONCIERGE_REPORT_ID, INTRO_SELECTED, TEST_USER_ACCOUNT_ID, undefined, false); + Report.clearCreateChatError(REPORT, CONCIERGE_REPORT_ID, INTRO_SELECTED, TEST_USER_ACCOUNT_ID, undefined, false, undefined, undefined, undefined); return waitForBatchedUpdates(); }) .then( @@ -437,7 +447,7 @@ describe('actions/Report', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${REPORT.reportID}`, {isOptimisticReport: true}); await waitForBatchedUpdates(); - Report.clearCreateChatError(REPORT, undefined, INTRO_SELECTED, TEST_USER_ACCOUNT_ID, betas, false); + Report.clearCreateChatError(REPORT, undefined, INTRO_SELECTED, TEST_USER_ACCOUNT_ID, betas, false, undefined, undefined, undefined); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -4743,7 +4753,7 @@ describe('actions/Report', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, testReport); await waitForBatchedUpdates(); - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined); + Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); @@ -4757,7 +4767,19 @@ describe('actions/Report', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, testReport); await waitForBatchedUpdates(); - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, true); + Report.navigateToConciergeChatAndDeleteReport( + REPORT_ID, + CONCIERGE_REPORT_ID, + TEST_USER_ACCOUNT_ID, + INTRO_SELECTED, + undefined, + undefined, + undefined, + undefined, + undefined, + true, + undefined, + ); await waitForBatchedUpdates(); @@ -4770,7 +4792,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.navigateToConciergeChatAndDeleteReport(undefined, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined); + Report.navigateToConciergeChatAndDeleteReport(undefined, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined, undefined); }).not.toThrow(); }); @@ -4779,7 +4801,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, undefined, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined); + Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, undefined, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined, undefined); }).not.toThrow(); await waitForBatchedUpdates(); @@ -4793,7 +4815,19 @@ describe('actions/Report', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, testReport); await waitForBatchedUpdates(); - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, false, true); + Report.navigateToConciergeChatAndDeleteReport( + REPORT_ID, + CONCIERGE_REPORT_ID, + TEST_USER_ACCOUNT_ID, + INTRO_SELECTED, + undefined, + undefined, + undefined, + undefined, + undefined, + false, + true, + ); await waitForBatchedUpdates(); @@ -4806,7 +4840,19 @@ describe('actions/Report', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, testReport); await waitForBatchedUpdates(); - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, true, true); + Report.navigateToConciergeChatAndDeleteReport( + REPORT_ID, + CONCIERGE_REPORT_ID, + TEST_USER_ACCOUNT_ID, + INTRO_SELECTED, + undefined, + undefined, + undefined, + undefined, + undefined, + true, + true, + ); await waitForBatchedUpdates(); @@ -4820,7 +4866,7 @@ describe('actions/Report', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, testReport); await waitForBatchedUpdates(); - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined); + Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); @@ -4835,7 +4881,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, undefined, undefined, undefined); + Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, undefined, undefined, undefined, undefined, undefined, undefined); }).not.toThrow(); await waitForBatchedUpdates(); @@ -4849,7 +4895,7 @@ describe('actions/Report', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, testReport); await waitForBatchedUpdates(); - Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, true, undefined); + Report.navigateToConciergeChatAndDeleteReport(REPORT_ID, CONCIERGE_REPORT_ID, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, true, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); @@ -4881,7 +4927,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); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -4900,7 +4946,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); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); @@ -4915,7 +4961,7 @@ describe('actions/Report', () => { Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${PARENT_REPORT_ID}`, PARENT_REPORT); await waitForBatchedUpdates(); - Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, {} as OnyxTypes.ReportAction, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, {} as OnyxTypes.ReportAction, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -4934,7 +4980,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); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(MOCK_NEW_THREAD_REPORT_ID)); @@ -4953,7 +4999,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); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); await waitForBatchedUpdates(); // Verify navigation happened with the new thread report @@ -4978,7 +5024,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); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, undefined, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -4998,7 +5044,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); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, testBetas, undefined, undefined); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -5032,7 +5078,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, isSelfTourViewed); + Report.navigateToAndOpenChildReport(undefined, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, introSelected, undefined, undefined, isSelfTourViewed); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -5070,7 +5116,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); + Report.navigateToAndOpenChildReport(EXISTING_CHILD_REPORT, PARENT_REPORT_ACTION, PARENT_REPORT, TEST_USER_ACCOUNT_ID, INTRO_SELECTED, undefined, undefined, undefined); await waitForBatchedUpdates(); expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(EXISTING_CHILD_REPORT.reportID)); @@ -5401,7 +5447,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined, 'hidden'); + Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined, 'hidden', undefined); }).not.toThrow(); }); @@ -5419,7 +5465,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined); + Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined, undefined, undefined); }).not.toThrow(); }); @@ -5437,7 +5483,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, undefined, true, undefined, 'hidden'); + Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, undefined, true, undefined, 'hidden', undefined); }).not.toThrow(); }); @@ -5464,6 +5510,7 @@ describe('actions/Report', () => { true, undefined, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, + undefined, ); }).not.toThrow(); }); @@ -5482,7 +5529,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, true, undefined); + Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, true, undefined, undefined, undefined); }).not.toThrow(); }); @@ -5500,7 +5547,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined); + Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined, undefined, undefined); }).not.toThrow(); }); @@ -5518,7 +5565,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, true, undefined, 'hidden'); + Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, true, undefined, 'hidden', undefined); }).not.toThrow(); }); @@ -5536,7 +5583,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined); + Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, false, undefined, undefined, undefined); }).not.toThrow(); }); @@ -5555,7 +5602,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, undefined, testBetas, 'hidden'); + Report.toggleSubscribeToChildReport(CHILD_REPORT_ID, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, undefined, testBetas, 'hidden', undefined); }).not.toThrow(); }); @@ -5574,7 +5621,7 @@ describe('actions/Report', () => { await waitForBatchedUpdates(); expect(() => { - Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, undefined, testBetas); + Report.toggleSubscribeToChildReport(undefined, TEST_USER_ACCOUNT_ID, PARENT_REPORT_ACTION, PARENT_REPORT, INTRO_SELECTED, undefined, testBetas, undefined, undefined); }).not.toThrow(); }); }); @@ -7135,7 +7182,7 @@ describe('actions/Report', () => { const testIntroSelected: OnyxTypes.IntroSelected = {choice: CONST.ONBOARDING_CHOICES.ADMIN}; - Report.navigateToAndOpenReportWithAccountIDs([PARTICIPANT_ACCOUNT_ID], TEST_USER_ACCOUNT_ID, testIntroSelected, isSelfTourViewed, undefined); + Report.navigateToAndOpenReportWithAccountIDs([PARTICIPANT_ACCOUNT_ID], TEST_USER_ACCOUNT_ID, testIntroSelected, isSelfTourViewed, undefined, undefined); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); @@ -7162,7 +7209,7 @@ describe('actions/Report', () => { const testIntroSelected: OnyxTypes.IntroSelected = {choice: CONST.ONBOARDING_CHOICES.ADMIN}; - Report.navigateToAndOpenReportWithAccountIDs([PARTICIPANT_ACCOUNT_ID], TEST_USER_ACCOUNT_ID, testIntroSelected, false, undefined); + Report.navigateToAndOpenReportWithAccountIDs([PARTICIPANT_ACCOUNT_ID], TEST_USER_ACCOUNT_ID, testIntroSelected, false, undefined, undefined); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 0); diff --git a/tests/ui/components/BaseReportActionContextMenuTest.tsx b/tests/ui/components/BaseReportActionContextMenuTest.tsx index 8f496d5e578a..d0e87e8dcc98 100644 --- a/tests/ui/components/BaseReportActionContextMenuTest.tsx +++ b/tests/ui/components/BaseReportActionContextMenuTest.tsx @@ -47,6 +47,7 @@ jest.mock('@components/FocusTrap/FocusTrapForModal', () => { jest.mock('@components/OnyxListItemProvider', () => ({ useSession: () => ({encryptedAuthToken: 'token'}), + usePersonalDetails: () => ({}), })); jest.mock('@hooks/useArrowKeyFocusManager', () => () => [-1, jest.fn()] as const);