Skip to content

[$1000] A failed IOU request has the “Cancel” feature as a successful IOU request and able to cancel the request #16748

Closed

Description

@kavimuru

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


Action Performed:

  1. Click on “Profile” avatar
  2. Click on “Preference” link
  3. Turn on “Simulate a network failure”
  4. Open an existing chat
  5. Click on “Actions” icon
  6. Click on “Request money” link
  7. Enter “Amount” and click on “Next” button
  8. Click on “Request” button
  9. Turn off “Simualte a network failure”
  10. Observe that Money request has an error message
  11. Click on the newly created IOU
  12. Observe that the failed “Cancel” button is active
  13. Click on the “Cancel” button

Expected Result:

“Cancel” button for failed IOUs shouldn't be clickable and should be disabled or hidden from the UI

Actual Result:

“Cancel” button for failed IOUs is active and clickable

Workaround:

unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.2.92-0
Reproducible in staging?:
Reproducible in production?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
image

2023-03-30.10.40.19.mp4
Recording.99.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Natnael-Guchima
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1680162826186869

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017fdfc602b8fa6805
  • Upwork Job ID: 1651528714235252736
  • Last Price Increase: 2023-05-10

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 30, 2023
  2. MelvinBot commented on Mar 30, 2023

    @MelvinBot
    Contributor

    Triggered auto assignment to @greg-schroeder (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. MelvinBot commented on Mar 30, 2023

    @MelvinBot
    Contributor

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. MelvinBot commented on Apr 3, 2023

    @MelvinBot
  5. deleted a comment from MelvinBot on Apr 5, 2023
  6. greg-schroeder commented on Apr 5, 2023

    @greg-schroeder
    Contributor

    Reviewing now

  7. greg-schroeder commented on Apr 5, 2023

    @greg-schroeder
    Contributor

    Hmm. I couldn't reproduce this where the error message pops up after simulating a network failure and then disabling that - it didn't show an error at all. I tested on staging.

    @Natnael-Guchima can you check your reproduction steps to make sure nothing is missing?

  8. Natnael-Guchima commented on Apr 5, 2023

    @Natnael-Guchima

    One minute, @greg-schroeder. Let me check and get back to you.

  9. Natnael-Guchima commented on Apr 5, 2023

    @Natnael-Guchima
    2023-04-05.19.56.24.mp4

    I can reproduce it in staging, @greg-schroeder.

    Steps:

    1. Open an existing chat
    2. Click profile avatar
    3. Click on preferences
    4. Turn on simulate a failing network
    5. Close settings
    6. Click on 'Actions' icon > Request Money > enter amount & submit
    7. Click on profile avatar > Preferences > Turn off simulate a network failure
    8. Close setting

    The above step should produce the error message. If error is thrown open the failed IOU and click on 'Cancel' button

  10. 40 remaining items

  11. Natnael-Guchima commented on May 10, 2023

    @Natnael-Guchima

    I'm currently seeing Delete instead of Cancel. Was the copy changed at some point?
    Screenshot 2023-05-10 at 12 50 50

    No, cancel and decline buttons are removed in favor of the new Delete button on this PR

    @Natnael-Guchima Thanks for the reply. So is this bug still applicable? But instead of Cancel, we should disable Delete if the request failed?

    You are welcome @akinwale. I am not sure if this bug is still applicable. I haven't heard anything from internal team on weather to pursue this or not.

  12. akinwale commented on May 10, 2023

    @akinwale
    Contributor

    Proposal

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

    "Cancel" button in the IOU details modal is being displayed for failed IOU requests. It is assumed that the Cancel button has been replaced by the "Delete" button based on this PR: #17583. This proposal will assume the Delete button going forward.

    What is the root cause of that problem?

    The filter for deletable transactions in the getDeletableTransactions method for IOUTransactions does not check for transactions that have a pendingAction. Hence, the Delete button is shown for failed transactions which have a pending action.

    return _.chain(actionsForIOUReport)
    .filter((action) => action.originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE)
    .filter((action) => !_.contains(deletedTransactionIDs, action.originalMessage.IOUTransactionID))
    .filter((action) => this.props.userEmail === action.actorEmail)
    .map((action) => lodashGet(action, 'originalMessage.IOUTransactionID', ''))
    .compact()
    .value();
    }

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

    Add a filter to remove transactions that have a pendingAction of add in the getDeletableTransactions method.

    .filter((action) => action.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD)
    

    Alternatively, if the button should not be displayed for all transactions that have a pending action, then the filter can be defined as such:

    .filter((action) => _.isEmpty(lodashGet(action, 'pendingAction', '')))
    

    What alternative solutions did you explore? (Optional)

    None.

  13. tienifr commented on May 11, 2023

    @tienifr
    Contributor

    Proposal

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

    The failed IOU request is still deleable

    What is the root cause of that problem?

    In

    return _.chain(actionsForIOUReport)
    .filter((action) => action.originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE)
    .filter((action) => !_.contains(deletedTransactionIDs, action.originalMessage.IOUTransactionID))
    .filter((action) => this.props.userEmail === action.actorEmail)
    .map((action) => lodashGet(action, 'originalMessage.IOUTransactionID', ''))
    .compact()
    .value();
    }

    We get the deletable transactions without filtering out the errors transaction

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

    Solution 1: If we don't want to show the delete button

    Filter out the error action by adding the following line:

    .filter((action) => !action.errors)
    

    Solution 2: If we want to disable the delete button

    1. add a new props (shouldDisableDelete) to ReportTransaction
    2. check if it is the error transaction set shouldDisableDelete= true, otherwise false

    Improvement

    We should move this line

    const deletableTransactions = this.getDeletableTransactions();

    outside of map function to improve performance.

    What alternative solutions did you explore? (Optional)

  14. roryabraham commented on May 11, 2023

    @roryabraham
    Contributor

    @tienifr your proposal with solution 1 LGTM 👍🏼

  15. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 11, 2023
  16. melvin-bot commented on May 11, 2023

    @melvin-bot

    📣 @tienifr You have been assigned to this job by @roryabraham!
    Please apply to this job in Upwork 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 📖

  17. roryabraham commented on May 11, 2023

    @roryabraham
    Contributor

    Also, would love to see some automated tests cover this change 🙏🏼

  18. 0xmiroslav commented on May 12, 2023

    @0xmiroslav
    Contributor

    @roryabraham thanks for the proposal review in advance. @tienifr's Solution 1 looks good to me too!
    👍 on some automated tests cover this change

  19. greg-schroeder commented on May 16, 2023

    @greg-schroeder
    Contributor

    Per discussion:

    Looking at the reproduction steps, I don’t think this is relevant anymore. We are deprecating cancel (though not delete).

    We're going to close the issue/PR and pay this out.

  20. greg-schroeder commented on May 16, 2023

    @greg-schroeder
    Contributor
  21. Natnael-Guchima commented on May 16, 2023

    @Natnael-Guchima

    @tienifr, @Natnael-Guchima, @0xmiroslav offers sent

    Accepted. Thanks!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions