diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 7751ce7be4b6..c2c404d7fea5 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1240,8 +1240,10 @@ const ROUTES = { TRANSACTION_RECEIPT: { route: 'r/:reportID/transaction/:transactionID/receipt', - getRoute: (reportID: string, transactionID: string, readonly = false) => `r/${reportID}/transaction/${transactionID}/receipt${readonly ? '?readonly=true' : ''}` as const, + getRoute: (reportID: string, transactionID: string, readonly = false, isFromReviewDuplicates = false) => + `r/${reportID}/transaction/${transactionID}/receipt?readonly=${readonly}${isFromReviewDuplicates ? '&isFromReviewDuplicates=true' : ''}` as const, }, + TRANSACTION_DUPLICATE_REVIEW_PAGE: { route: 'r/:threadReportID/duplicates/review', getRoute: (threadReportID: string, backTo?: string) => getUrlWithBackToParam(`r/${threadReportID}/duplicates/review` as const, backTo), diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 9a0861962637..5dc56caa0ff6 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -56,6 +56,9 @@ type MoneyRequestViewProps = { /** Whether we should show Money Request with disabled all fields */ readonly?: boolean; + /** whether or not this report is from review duplicates */ + isFromReviewDuplicates?: boolean; + /** Updated transaction to show in duplicate transaction flow */ updatedTransaction?: OnyxEntry; }; @@ -75,7 +78,7 @@ const getTransactionID = (report: OnyxEntry, parentReportActio return originalMessage?.IOUTransactionID ?? -1; }; -function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = false, updatedTransaction}: MoneyRequestViewProps) { +function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = false, updatedTransaction, isFromReviewDuplicates = false}: MoneyRequestViewProps) { const theme = useTheme(); const styles = useThemeStyles(); const session = useSession(); @@ -508,6 +511,7 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals transaction={updatedTransaction ?? transaction} enablePreviewModal readonly={readonly || !canEditReceipt} + isFromReviewDuplicates={isFromReviewDuplicates} /> )} diff --git a/src/components/ReportActionItem/ReportActionItemImage.tsx b/src/components/ReportActionItem/ReportActionItemImage.tsx index d967a914c9f9..668338440f73 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.tsx +++ b/src/components/ReportActionItem/ReportActionItemImage.tsx @@ -55,6 +55,9 @@ type ReportActionItemImageProps = { /** Whether the receipt is not editable */ readonly?: boolean; + + /** whether or not this report is from review duplicates */ + isFromReviewDuplicates?: boolean; }; /** @@ -75,6 +78,7 @@ function ReportActionItemImage({ isSingleImage = true, readonly = false, shouldMapHaveBorderRadius, + isFromReviewDuplicates = false, }: ReportActionItemImageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -135,7 +139,12 @@ function ReportActionItemImage({ style={[styles.w100, styles.h100, styles.noOutline as ViewStyle]} onPress={() => Navigation.navigate( - ROUTES.TRANSACTION_RECEIPT.getRoute(transactionThreadReport?.reportID ?? report?.reportID ?? '-1', transaction?.transactionID ?? '-1', readonly), + ROUTES.TRANSACTION_RECEIPT.getRoute( + transactionThreadReport?.reportID ?? report?.reportID ?? '-1', + transaction?.transactionID ?? '-1', + readonly, + isFromReviewDuplicates, + ), ) } accessibilityLabel={translate('accessibilityHints.viewAttachment')} diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index f1d5b38b6f44..cbd6a2af95bf 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1520,6 +1520,7 @@ type AuthScreensParamList = CentralPaneScreensParamList & reportID: string; transactionID: string; readonly?: boolean; + isFromReviewDuplicates?: boolean; }; [SCREENS.CONNECTION_COMPLETE]: undefined; }; diff --git a/src/pages/TransactionDuplicate/Confirmation.tsx b/src/pages/TransactionDuplicate/Confirmation.tsx index b26ae615b465..87748a9697a7 100644 --- a/src/pages/TransactionDuplicate/Confirmation.tsx +++ b/src/pages/TransactionDuplicate/Confirmation.tsx @@ -118,6 +118,7 @@ function Confirmation() { report={report} shouldShowAnimatedBackground={false} readonly + isFromReviewDuplicates updatedTransaction={transaction as OnyxEntry} /> diff --git a/src/pages/TransactionReceiptPage.tsx b/src/pages/TransactionReceiptPage.tsx index 194759f78ccb..c05d90a180e1 100644 --- a/src/pages/TransactionReceiptPage.tsx +++ b/src/pages/TransactionReceiptPage.tsx @@ -28,6 +28,7 @@ function TransactionReceipt({route}: TransactionReceiptProps) { const isLocalFile = receiptURIs.isLocalFile; const readonly = route.params.readonly ?? false; + const isFromReviewDuplicates = route.params.isFromReviewDuplicates ?? false; const parentReportAction = ReportActionUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1'); const canEditReceipt = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.RECEIPT); @@ -61,7 +62,8 @@ function TransactionReceipt({route}: TransactionReceiptProps) { const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report); // eslint-disable-next-line rulesdir/no-negated-variables - const shouldShowNotFoundPage = isTrackExpenseReport || transaction?.reportID === CONST.REPORT.SPLIT_REPORTID ? !transaction : (moneyRequestReportID ?? '-1') !== transaction?.reportID; + const shouldShowNotFoundPage = + isTrackExpenseReport || transaction?.reportID === CONST.REPORT.SPLIT_REPORTID || isFromReviewDuplicates ? !transaction : (moneyRequestReportID ?? '-1') !== transaction?.reportID; return (