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

[HOLD for payment 2024-08-29] [$250] Dupe detect-Removing receipt on confirmation page also removes receipt from the actual expense #46373

Closed
6 tasks done
lanitochka17 opened this issue Jul 27, 2024 · 42 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 27, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.13-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Submit two expenses with same amount and merchant, but one with receipt and one without receipt
  4. Click on the transaction thread of the expense with receipt
  5. Click Review duplicates
  6. Click Keep this one on the expense with receipt
  7. Proceed to confirmation page
  8. Click on the receipt on the confirmation page
  9. Remove the receipt

Expected Result:

Since user is removing the receipt from the confirmation page, the receipt on the actual expense will not be removed, as the changes have not been "confirmed" yet

Actual Result:

When user removes the receipt from the confirmation page, the receipt on the actual expense is also removed, even when the Confirm button is not clicked

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6554746_1722091745819.bandicam_2024-07-27_22-40-17-853.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e50d0c63fac1b4f3
  • Upwork Job ID: 1818139062818817325
  • Last Price Increase: 2024-07-30
  • Automatic offers:
    • gijoe0295 | Contributor | 103539656
Issue OwnerCurrent Issue Owner: @anmurali
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 27, 2024
Copy link

melvin-bot bot commented Jul 27, 2024

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@anmurali FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 2

@gijoe0295
Copy link
Contributor

gijoe0295 commented Jul 28, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

When user removes the receipt from the confirmation page, the receipt on the actual expense is also removed, even when the Confirm button is not clicked

What is the root cause of that problem?

We should not allow edit/delete the receipt when in duplicate confirmation page, just like other fields are not editable.

<MoneyRequestView
report={report}
shouldShowAnimatedBackground={false}
readonly

interactive={canEditAmount && !readonly}

What changes do you think we should make in order to solve the problem?

To do that, we need to implement a mechanism to pass readonly from MoneyRequestView to TransactionReceipt page. Since they are not within a component tree, we can leverage the route params.

  1. Introduce a new prop readonly to ReportActionItemImage and pass it from MoneyRequestView here
  2. Introduce a new param readonly to TransactionReceipt screen here and its route here
  3. When we navigate to TransactionReceipt screen from ReportActionItemImage here, remember to pass readonly to getRoute
  4. In TransactionReceipt, retrieve the readonly param from route and append to the canEditReceipt condition here to canEditReceipt={canEditReceipt && !readonly}

@gijoe0295
Copy link
Contributor

Proposal Update

  • Update code permalink
  • Add detailed explanation to solution and RCA (no changes in general idea)

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jul 28, 2024

Edited by proposal-police: This proposal was edited at 2023-10-10T12:34:56Z.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Dupe detect-Removing receipt on confirmation page also removes receipt from the actual expense

What is the root cause of that problem?

  • On dupe confirmation page we disable all the field except receipt ReportActionItemImage. We should not allow user to open receipt on confirmation page, this is also the behaviour on submit request confirmation page.
    <ReportActionItemImage
    thumbnail={receiptURIs?.thumbnail}
    fileExtension={receiptURIs?.fileExtension}
    isThumbnail={receiptURIs?.isThumbnail}
    image={receiptURIs?.image}
    isLocalFile={receiptURIs?.isLocalFile}
    filename={receiptURIs?.filename}
    transaction={transaction}
    enablePreviewModal
    />
money_request_confrimation.mp4

What changes do you think we should make in order to solve the problem?

  • We already have enablePreviewModal prop in ReportActionItemImage.tsx which will prevent the app to open modal when enablePreviewModal is false because it renders only ReceiptImage without PressableWithoutFocus.
    if (enablePreviewModal) {
    return (
    <ShowContextMenuContext.Consumer>
    {({report, transactionThreadReport}) => (
    <PressableWithoutFocus
    style={[styles.w100, styles.h100, styles.noOutline as ViewStyle]}
    onPress={() =>
    Navigation.navigate(ROUTES.TRANSACTION_RECEIPT.getRoute(transactionThreadReport?.reportID ?? report?.reportID ?? '-1', transaction?.transactionID ?? '-1'))
    }
    accessibilityLabel={translate('accessibilityHints.viewAttachment')}
    accessibilityRole={CONST.ROLE.BUTTON}
    >
    <ReceiptImage {...propsObj} />
    </PressableWithoutFocus>
    )}
    </ShowContextMenuContext.Consumer>
    );
    }
    return <ReceiptImage {...propsObj} />;
  • We need to update the enablePreviewModal prop to enablePreviewModal={!readonly}.

What alternative solutions did you explore? (Optional)

  • We can introduce a new prop interactive in ReportActionItemImage and pass it to PressableWithoutFocus interactive prop. The default value will be true
  • From MoneyRequestView we can pass !readonly to interactive prop of ReportActionItemImage.

Result

receipt_image_interactive_dupe_detection.mp4

Alternative

We can check the last route and if it is SCREENS.TRANSACTION_DUPLICATE.REVIEW, we will set the canEditReceipt to false. Similar approach is used here to do tasks according to the previous route. I still prefer the main solution since all other fields are also disabled and receipt should also behave the same way.

    const isLastRouteDuplicateReview = (navigationRef.getRootState()?.routes?.at(-2)?.params?.params?.screen ?? '') === SCREENS.TRANSACTION_DUPLICATE.REVIEW;
    const canEditReceipt = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.RECEIPT) && !isLastRouteDuplicateReview;
    
    // If we want to hide the three dot icon, we can modify `allowDownload` prop.
    allowDownload={!isEReceipt && !isLastRouteDuplicateReview}

const canEditReceipt = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.RECEIPT);

allowDownload={!isEReceipt}

Result Alternative

Monosnap.screencast.2024-07-31.18-11-07.mp4

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Jul 30, 2024
@melvin-bot melvin-bot bot changed the title Dupe detect-Removing receipt on confirmation page also removes receipt from the actual expense [$250] Dupe detect-Removing receipt on confirmation page also removes receipt from the actual expense Jul 30, 2024
Copy link

melvin-bot bot commented Jul 30, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01e50d0c63fac1b4f3

@melvin-bot melvin-bot bot added Overdue Help Wanted Apply this label when an issue is open to proposals by contributors labels Jul 30, 2024
Copy link

melvin-bot bot commented Jul 30, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

@melvin-bot melvin-bot bot removed the Overdue label Jul 30, 2024
@Krishna2323
Copy link
Contributor

Proposal Updated

  • Added alternative solution and result video for that

@JmillsExpensify
Copy link

@sobitneupane mind reviewing the proposals so far?

@melvin-bot melvin-bot bot added the Overdue label Aug 1, 2024
@sobitneupane
Copy link
Contributor

Thanks for the proposal everyone.

Proposal from @Krishna2323 looks good to me.

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

Triggered auto assignment to @stitesExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link
Contributor

github-actions bot commented Aug 2, 2024

true

@gijoe0295
Copy link
Contributor

@sobitneupane That means they cannot even preview the receipt. I think we only need to block deleting. @JmillsExpensify can you confirm the expected behavior here?

@trjExpensify
Copy link
Contributor

I agree, they should be able to open the receipt in the full screen mode, but it's read-only, like the other fields on the expense in this dupe confirmation screen - so we should remove the three dot overflow menu in this case:

image

CC: @pecanoro for vis as well :)

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
Copy link

melvin-bot bot commented Aug 5, 2024

@anmurali, @sobitneupane, @stitesExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@stitesExpensify
Copy link
Contributor

Thank you both for taking a second look! Moving forward with @gijoe0295

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 15, 2024
Copy link

melvin-bot bot commented Aug 15, 2024

📣 @gijoe0295 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@dylanexpensify
Copy link
Contributor

@gijoe0295 mind giving us a rough idea of when you'll have the PR raised for review?

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Aug 16, 2024
@melvin-bot melvin-bot bot changed the title [$250] Dupe detect-Removing receipt on confirmation page also removes receipt from the actual expense [HOLD for payment 2024-08-29] [$250] Dupe detect-Removing receipt on confirmation page also removes receipt from the actual expense Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.23-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-08-29. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Aug 22, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@anmurali] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 28, 2024
@gijoe0295
Copy link
Contributor

@anmurali This is ready for payment.

@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2024
@sobitneupane
Copy link
Contributor

sobitneupane commented Sep 2, 2024

Regression Test Proposal:

  1. Submit 2 duplicated expenses with receipts
  2. Go to the thread transaction report
  3. Press Review duplicates
  4. Proceed to confirmation page
  5. Press receipt preview
  6. Press 3-dot menu
  7. Verify "Replace" and "Delete receipt" options are not shown

Do we agree 👍 or 👎

@sobitneupane
Copy link
Contributor

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

#40153

  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

I don't think we can blame the PR for creating this issue as it is more of a feature-request than a bug.

  • [@sobitneupane] Determine if we should create a regression test for this bug.

Yes.

  • [@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

#46373 (comment)

Copy link

melvin-bot bot commented Sep 2, 2024

@anmurali, @sobitneupane, @stitesExpensify, @gijoe0295 Huh... This is 4 days overdue. Who can take care of this?

@stitesExpensify
Copy link
Contributor

@anmurali all you on this one!

Copy link

melvin-bot bot commented Sep 4, 2024

@anmurali, @sobitneupane, @stitesExpensify, @gijoe0295 Still overdue 6 days?! Let's take care of this!

Copy link

melvin-bot bot commented Sep 6, 2024

@anmurali, @sobitneupane, @stitesExpensify, @gijoe0295 Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

@anmurali
Copy link

anmurali commented Sep 9, 2024

Payment Summary

@anmurali anmurali closed this as completed Sep 9, 2024
@melvin-bot melvin-bot bot removed the Overdue label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

9 participants