From 9f8e8c5abcb7c3d842398de18a516eb8b79d36ce Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 10 Oct 2024 16:32:29 +0700 Subject: [PATCH 1/4] fix: Not here page opens when opening distance receipt from another workspace --- src/ROUTES.ts | 4 +++- src/components/ReportActionItem/MoneyRequestView.tsx | 5 ++++- .../ReportActionItem/ReportActionItemImage.tsx | 10 +++++++++- src/libs/Navigation/types.ts | 1 + src/pages/TransactionDuplicate/Confirmation.tsx | 1 + src/pages/TransactionReceiptPage.tsx | 4 +++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 02bb07de83b2..e554b623bd57 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1176,8 +1176,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=true' : ''}${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..4af17b194d26 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -56,6 +56,8 @@ type MoneyRequestViewProps = { /** Whether we should show Money Request with disabled all fields */ readonly?: boolean; + isFromReviewDuplicates?: boolean; + /** Updated transaction to show in duplicate transaction flow */ updatedTransaction?: OnyxEntry; }; @@ -75,7 +77,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}: MoneyRequestViewProps) { const theme = useTheme(); const styles = useThemeStyles(); const session = useSession(); @@ -508,6 +510,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..c140222517c5 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.tsx +++ b/src/components/ReportActionItem/ReportActionItemImage.tsx @@ -55,6 +55,8 @@ type ReportActionItemImageProps = { /** Whether the receipt is not editable */ readonly?: boolean; + + isFromReviewDuplicates?: boolean; }; /** @@ -75,6 +77,7 @@ function ReportActionItemImage({ isSingleImage = true, readonly = false, shouldMapHaveBorderRadius, + isFromReviewDuplicates, }: ReportActionItemImageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -135,7 +138,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 3e7c03b4098d..60049a22a3fe 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -1481,6 +1481,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 ( Date: Thu, 10 Oct 2024 23:17:02 +0700 Subject: [PATCH 2/4] minor change --- src/ROUTES.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index e554b623bd57..de675fa8b3bf 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1177,7 +1177,7 @@ const ROUTES = { TRANSACTION_RECEIPT: { route: 'r/:reportID/transaction/:transactionID/receipt', getRoute: (reportID: string, transactionID: string, readonly = false, isFromReviewDuplicates = false) => - `r/${reportID}/transaction/${transactionID}/receipt${readonly ? '?readonly=true' : ''}${isFromReviewDuplicates ? '?isFromReviewDuplicates=true' : ''}` as const, + `r/${reportID}/transaction/${transactionID}/receipt${readonly ? '?readonly=true' : ''}${isFromReviewDuplicates ? '&isFromReviewDuplicates=true' : ''}` as const, }, TRANSACTION_DUPLICATE_REVIEW_PAGE: { From 01a9daad5c2b56c5461cc6eaccd7bb6b6aaf7aef Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 14 Oct 2024 14:46:50 +0700 Subject: [PATCH 3/4] fix: add default value to isFromReviewDuplicates --- src/ROUTES.ts | 2 +- src/components/ReportActionItem/MoneyRequestView.tsx | 2 +- src/components/ReportActionItem/ReportActionItemImage.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index de675fa8b3bf..c318ff8834d9 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1177,7 +1177,7 @@ const ROUTES = { TRANSACTION_RECEIPT: { route: 'r/:reportID/transaction/:transactionID/receipt', getRoute: (reportID: string, transactionID: string, readonly = false, isFromReviewDuplicates = false) => - `r/${reportID}/transaction/${transactionID}/receipt${readonly ? '?readonly=true' : ''}${isFromReviewDuplicates ? '&isFromReviewDuplicates=true' : ''}` as const, + `r/${reportID}/transaction/${transactionID}/receipt?readonly=${readonly}${isFromReviewDuplicates ? '&isFromReviewDuplicates=true' : ''}` as const, }, TRANSACTION_DUPLICATE_REVIEW_PAGE: { diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 4af17b194d26..2d4f44c35c93 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -77,7 +77,7 @@ const getTransactionID = (report: OnyxEntry, parentReportActio return originalMessage?.IOUTransactionID ?? -1; }; -function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = false, updatedTransaction, isFromReviewDuplicates}: MoneyRequestViewProps) { +function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = false, updatedTransaction, isFromReviewDuplicates = false}: MoneyRequestViewProps) { const theme = useTheme(); const styles = useThemeStyles(); const session = useSession(); diff --git a/src/components/ReportActionItem/ReportActionItemImage.tsx b/src/components/ReportActionItem/ReportActionItemImage.tsx index c140222517c5..794902b67856 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.tsx +++ b/src/components/ReportActionItem/ReportActionItemImage.tsx @@ -77,7 +77,7 @@ function ReportActionItemImage({ isSingleImage = true, readonly = false, shouldMapHaveBorderRadius, - isFromReviewDuplicates, + isFromReviewDuplicates = false, }: ReportActionItemImageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); From ef00285e769cea5002463e4d676b9cbf8d6397ad Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 15 Oct 2024 11:17:10 +0700 Subject: [PATCH 4/4] add comment --- src/components/ReportActionItem/MoneyRequestView.tsx | 1 + src/components/ReportActionItem/ReportActionItemImage.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 2d4f44c35c93..5dc56caa0ff6 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -56,6 +56,7 @@ 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 */ diff --git a/src/components/ReportActionItem/ReportActionItemImage.tsx b/src/components/ReportActionItem/ReportActionItemImage.tsx index 794902b67856..668338440f73 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.tsx +++ b/src/components/ReportActionItem/ReportActionItemImage.tsx @@ -56,6 +56,7 @@ type ReportActionItemImageProps = { /** Whether the receipt is not editable */ readonly?: boolean; + /** whether or not this report is from review duplicates */ isFromReviewDuplicates?: boolean; };