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

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

Closed
1 of 6 tasks
kavimuru opened this issue Mar 30, 2023 · 32 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kavimuru
Copy link

kavimuru commented Mar 30, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 30, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Mar 30, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Apr 3, 2023
@MelvinBot

This comment was marked as resolved.

@Expensify Expensify deleted a comment from MelvinBot Apr 5, 2023
@greg-schroeder
Copy link
Contributor

Reviewing now

@melvin-bot melvin-bot bot removed the Overdue label Apr 5, 2023
@greg-schroeder greg-schroeder added the Needs Reproduction Reproducible steps needed label Apr 5, 2023
@greg-schroeder
Copy link
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?

@Natnael-Guchima
Copy link

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

@Natnael-Guchima
Copy link

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

@greg-schroeder greg-schroeder reopened this Apr 5, 2023
@greg-schroeder
Copy link
Contributor

Let me try it again, thanks for checking!

@melvin-bot melvin-bot bot added the Overdue label Apr 10, 2023
@MelvinBot

This comment was marked as resolved.

@MelvinBot

This comment was marked as resolved.

@melvin-bot melvin-bot bot removed the Overdue label Apr 17, 2023
@Expensify Expensify deleted a comment from MelvinBot Apr 17, 2023
@Expensify Expensify deleted a comment from MelvinBot Apr 17, 2023
@MelvinBot

This comment was marked as resolved.

@melvin-bot melvin-bot bot added the Overdue label Apr 20, 2023
@MelvinBot

This comment was marked as resolved.

@MelvinBot

This comment was marked as resolved.

@MelvinBot

This comment was marked as resolved.

@melvin-bot melvin-bot bot added the Internal Requires API changes or must be handled by Expensify staff label Apr 27, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~017fdfc602b8fa6805

@melvin-bot
Copy link

melvin-bot bot commented May 10, 2023

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

@akinwale
Copy link
Contributor

I'm currently seeing Delete instead of Cancel. Was the copy changed at some point?

Screenshot 2023-05-10 at 12 50 50

@Natnael-Guchima
Copy link

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

@akinwale
Copy link
Contributor

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?

@Natnael-Guchima
Copy link

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.

@akinwale
Copy link
Contributor

akinwale commented May 10, 2023

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.

@tienifr
Copy link
Contributor

tienifr commented May 11, 2023

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)

@roryabraham
Copy link
Contributor

@tienifr your proposal with solution 1 LGTM 👍🏼

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 11, 2023

📣 @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 📖

@roryabraham
Copy link
Contributor

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

@roryabraham roryabraham removed the Needs Reproduction Reproducible steps needed label May 11, 2023
@0xmiros
Copy link
Contributor

0xmiros commented May 12, 2023

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

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label May 12, 2023
@greg-schroeder
Copy link
Contributor

greg-schroeder commented May 16, 2023

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.

@greg-schroeder
Copy link
Contributor

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

@Natnael-Guchima
Copy link

@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
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

10 participants