Skip to content

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

Closed

Description

@lanitochka17

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 27, 2024
  2. melvin-bot commented on Jul 27, 2024

    @melvin-bot

    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.

  3. lanitochka17 commented on Jul 27, 2024

    @lanitochka17
    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

  4. lanitochka17 commented on Jul 27, 2024

    @lanitochka17
    Author

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

  5. gijoe0295 commented on Jul 28, 2024

    @gijoe0295
    Contributor

    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}
  6. gijoe0295 commented on Jul 28, 2024

    @gijoe0295
    Contributor

    Proposal Update

    • Update code permalink
    • Add detailed explanation to solution and RCA (no changes in general idea)
  7. Krishna2323 commented on Jul 28, 2024

    @Krishna2323
    Contributor

    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
  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 30, 2024
  9. 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[/+] on Jul 30, 2024
  10. melvin-bot commented on Jul 30, 2024

    @melvin-bot
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 30, 2024
  12. 46 remaining items

  13. gijoe0295 commented on Aug 29, 2024

    @gijoe0295
    Contributor

    @anmurali This is ready for payment.

  14. sobitneupane commented on Sep 2, 2024

    @sobitneupane
    Contributor

    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 👎

  15. sobitneupane commented on Sep 2, 2024

    @sobitneupane
    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)

  16. melvin-bot commented on Sep 2, 2024

    @melvin-bot

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

  17. stitesExpensify commented on Sep 3, 2024

    @stitesExpensify
    Contributor

    @anmurali all you on this one!

  18. melvin-bot commented on Sep 4, 2024

    @melvin-bot

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

  19. melvin-bot commented on Sep 6, 2024

    @melvin-bot

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

  20. anmurali commented on Sep 9, 2024

    @anmurali

    Payment Summary

  21. garrettmknight commented on Oct 23, 2024

    @garrettmknight
    Contributor

    $250 approved for @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions