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 scan in progress shown for manual request with receipt moved from tracked expense #42984

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
2 changes: 1 addition & 1 deletion src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function isScanRequest(transaction: OnyxEntry<Transaction>): boolean {
return transaction?.iouRequestType === CONST.IOU.REQUEST_TYPE.SCAN;
}

return Boolean(transaction?.receipt?.source);
return Boolean(transaction?.receipt?.source) && transaction?.amount === 0;
}

function getRequestType(transaction: OnyxEntry<Transaction>): IOURequestType {
Expand Down
11 changes: 7 additions & 4 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function IOURequestStepConfirmation({
const isSharingTrackExpense = action === CONST.IOU.ACTION.SHARE;
const isCategorizingTrackExpense = action === CONST.IOU.ACTION.CATEGORIZE;
const isSubmittingFromTrackExpense = action === CONST.IOU.ACTION.SUBMIT;
const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action);
const payeePersonalDetails = useMemo(() => {
if (personalDetails?.[transaction?.splitPayerAccountIDs?.[0] ?? -1]) {
return personalDetails?.[transaction?.splitPayerAccountIDs?.[0] ?? -1];
Expand Down Expand Up @@ -468,7 +469,7 @@ function IOURequestStepConfirmation({
return;
}

if (requestType === CONST.IOU.REQUEST_TYPE.DISTANCE && !IOUUtils.isMovingTransactionFromTrackExpense(action)) {
if (requestType === CONST.IOU.REQUEST_TYPE.DISTANCE && !isMovingTransactionFromTrackExpense) {
const customUnitRateID = TransactionUtils.getRateID(transaction) ?? '';
createDistanceRequest(selectedParticipants, trimmedComment, customUnitRateID);
return;
Expand All @@ -489,7 +490,7 @@ function IOURequestStepConfirmation({
createDistanceRequest,
isSharingTrackExpense,
isCategorizingTrackExpense,
action,
isMovingTransactionFromTrackExpense,
policy,
policyTags,
policyCategories,
Expand Down Expand Up @@ -538,7 +539,9 @@ function IOURequestStepConfirmation({
<HeaderWithBackButton
title={headerTitle}
onBackButtonPress={navigateBack}
shouldShowThreeDotsButton={requestType === CONST.IOU.REQUEST_TYPE.MANUAL && (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK)}
shouldShowThreeDotsButton={
requestType === CONST.IOU.REQUEST_TYPE.MANUAL && (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK) && !isMovingTransactionFromTrackExpense
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried replace the tracked expense receipt and BE will revert it back to the original receipt, so I hide the 3-dot button when moving tracked expense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify where exactly this was occuring? Maybe post a video, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one
image

In main, the 3-dot button doesn't show because the requestType is SCAN, but because we fix it here, the requestType is now manual.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen.Recording.2024-06-04.at.21.14.24.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, yeah I think this makes sense at least for now until it's fixed on the backend.

}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)}
threeDotsMenuItems={[
{
Expand Down Expand Up @@ -569,7 +572,7 @@ function IOURequestStepConfirmation({
iouMerchant={transaction?.merchant}
iouCreated={transaction?.created}
isDistanceRequest={requestType === CONST.IOU.REQUEST_TYPE.DISTANCE}
shouldShowSmartScanFields={IOUUtils.isMovingTransactionFromTrackExpense(action) ? transaction?.amount !== 0 : requestType !== CONST.IOU.REQUEST_TYPE.SCAN}
shouldShowSmartScanFields={isMovingTransactionFromTrackExpense ? transaction?.amount !== 0 : requestType !== CONST.IOU.REQUEST_TYPE.SCAN}
action={action}
payeePersonalDetails={payeePersonalDetails}
/>
Expand Down
Loading