Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Not here page opens when opening distance receipt from another workspace #50546

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}${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),
Expand Down
6 changes: 5 additions & 1 deletion src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved

/** Updated transaction to show in duplicate transaction flow */
updatedTransaction?: OnyxEntry<OnyxTypes.Transaction>;
};
Expand All @@ -75,7 +78,7 @@ const getTransactionID = (report: OnyxEntry<OnyxTypes.Report>, 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();
Expand Down Expand Up @@ -508,6 +511,7 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
transaction={updatedTransaction ?? transaction}
enablePreviewModal
readonly={readonly || !canEditReceipt}
isFromReviewDuplicates={isFromReviewDuplicates}
/>
</View>
)}
Expand Down
11 changes: 10 additions & 1 deletion src/components/ReportActionItem/ReportActionItemImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
};

/**
Expand All @@ -75,6 +78,7 @@ function ReportActionItemImage({
isSingleImage = true,
readonly = false,
shouldMapHaveBorderRadius,
isFromReviewDuplicates = false,
}: ReportActionItemImageProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down Expand Up @@ -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')}
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,7 @@ type AuthScreensParamList = CentralPaneScreensParamList &
reportID: string;
transactionID: string;
readonly?: boolean;
isFromReviewDuplicates?: boolean;
};
[SCREENS.CONNECTION_COMPLETE]: undefined;
};
Expand Down
1 change: 1 addition & 0 deletions src/pages/TransactionDuplicate/Confirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function Confirmation() {
report={report}
shouldShowAnimatedBackground={false}
readonly
isFromReviewDuplicates
updatedTransaction={transaction as OnyxEntry<Transaction>}
/>
</ShowContextMenuContext.Provider>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/TransactionReceiptPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 (
<AttachmentModal
Expand Down
Loading