App
App copied to clipboard
[Search v1] - "Delete" option appears for paid expenses for submitter
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Issue found when validating #44385 Version Number: 9.0.4-0 Reproducible in staging?: y Reproducible in production?: no 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 Expensify/Expensify Issue URL: Issue reported by: Applause internal team Slack conversation:
Action Performed:
- User as a submitter has at least one paid expense.
- Go to staging.new.expensify.com
- Go to Search > Expenses.
- Click on the checkbox of the paid expense.
- Click on the dropdown button.
Expected Result:
"Delete" option will not appear for paid expenses.
Actual Result:
"Delete" option appears for paid expenses, and nothing happens when deleting it. As a result, user cannot bulk delete the expenses when both paid and unpaid expenses are selected.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/Expensify/App/assets/38435837/056aee1b-4408-41d9-93fd-508971e89b6a
Triggered auto assignment to @robertjchen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.
Triggered auto assignment to @kadiealexander (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.
:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
@kadiealexander 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
We think that this bug might be related to #vip-vsb
Proposal
Please re-state the problem that we are trying to solve in this issue.
"Delete" option appears for paid expenses, and nothing happens when deleting it. As a result, user cannot bulk delete the expenses when both paid and unpaid expenses are selected.
What is the root cause of that problem?
We show the delete option if itemsToDelete is not an empty array and the itemsToDelete is filtered out from selectedItemsKeys by checking item.canDelete. But after the transaction is paid, item.canDelete still true. And then the delete option still appears if we only selected the paid expense.
https://github.com/Expensify/App/blob/a84f68eeb1f72d0ca3308a4bdc9dc78e59a46d2e/src/components/Search/SearchPageHeader.tsx#L50-L55
What changes do you think we should make in order to solve the problem?
We should filter out the item here if it's paid by checking item.action is CONST.SEARCH.ACTION_TYPES.PAID or not.
const itemsToDelete = selectedItemsKeys.filter((id) => selectedItems[id].canDelete && item.action !== CONST.SEARCH.ACTION_TYPES.PAID);
https://github.com/Expensify/App/blob/a84f68eeb1f72d0ca3308a4bdc9dc78e59a46d2e/src/components/Search/SearchPageHeader.tsx#L50
And I think BE also need to update canDelete of transaction item to false when it's paid.
What alternative solutions did you explore? (Optional)
NA
This should be fixed on the backend, since the backend has all the information to decide if a transaction can be deleted or not.
@luacmartins, @kadiealexander Whoops! This issue is 2 days overdue. Let's get this updated quick!
Not overdue!
PR up
@luacmartins, @kadiealexander Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@luacmartins looks like we can close this, yeah?
Yea, I confirmed the fix in staging