App icon indicating copy to clipboard operation
App copied to clipboard

[Search v1] - "Delete" option appears for paid expenses for submitter

Open m-natarajan opened this issue 1 year ago • 9 comments

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.
  1. Go to staging.new.expensify.com
  2. Go to Search > Expenses.
  3. Click on the checkbox of the paid expense.
  4. 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

View all open jobs on GitHub

m-natarajan avatar Jul 04 '24 03:07 m-natarajan

Triggered auto assignment to @robertjchen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

melvin-bot[bot] avatar Jul 04 '24 03:07 melvin-bot[bot]

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.

melvin-bot[bot] avatar Jul 04 '24 03:07 melvin-bot[bot]

: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:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

github-actions[bot] avatar Jul 04 '24 03:07 github-actions[bot]

@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

m-natarajan avatar Jul 04 '24 03:07 m-natarajan

We think that this bug might be related to #vip-vsb

m-natarajan avatar Jul 04 '24 03:07 m-natarajan

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

nkdengineer avatar Jul 04 '24 09:07 nkdengineer

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 avatar Jul 04 '24 20:07 luacmartins

@luacmartins, @kadiealexander Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Jul 08 '24 18:07 melvin-bot[bot]

Not overdue!

kadiealexander avatar Jul 09 '24 02:07 kadiealexander

PR up

luacmartins avatar Jul 11 '24 22:07 luacmartins

@luacmartins, @kadiealexander Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Jul 15 '24 18:07 melvin-bot[bot]

@luacmartins looks like we can close this, yeah?

kadiealexander avatar Jul 16 '24 04:07 kadiealexander

Yea, I confirmed the fix in staging Screenshot 2024-07-16 at 9 20 45 AM

luacmartins avatar Jul 16 '24 15:07 luacmartins