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

[HOLD for payment 2024-12-19] [Search v1.2] - Different approval behavior when approving one held expense vs multiple held expenses #53012

Open
8 tasks done
IuliiaHerets opened this issue Nov 23, 2024 · 16 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Nov 23, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.66-0
Reproducible in staging?: Y
Reproducible in production?: N/A - new feature, doesn't exist in prod
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Add approvals feature is enabled.
  • Admin is the approver.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit an expense and hold the expense.
  4. Go to Search.
  5. Click Approve button on the expense.
  6. Note that it opens expense RHP and the approval can only be done from the expense RHP.
  7. Go back to workspace chat.
  8. Submit another expense (so there are two expenses in the same report, with one held and the other unheld).
  9. Go to Search > Outstanding.
  10. Click Approve.

Expected Result:

App should open expense report RHP so that approval can be done by approving the pending amount or all amount.

Actual Result:

Expense report with held expense can be approved without the confirmation modal in Search.

There is inconsistency when approving only one held expense and approving two expenses with different held status.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6674042_1732360026672.20241123_190310.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @trjExpensify
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Nov 23, 2024
Copy link

melvin-bot bot commented Nov 23, 2024

Triggered auto assignment to @trjExpensify (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.

Copy link

melvin-bot bot commented Nov 23, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Nov 23, 2024
Copy link

melvin-bot bot commented Nov 23, 2024

💬 A slack conversation has been started in #expensify-open-source

Copy link
Contributor

👋 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.

@gijoe0295
Copy link
Contributor

Proposal

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

Expense report with held expense can be approved without the confirmation modal in Search.

What is the root cause of that problem?

We're checking if the report has any held transactions to open the report RHP:

const hasHeldExpense = ReportUtils.hasHeldExpenses('', allReportTransactions);
if (hasHeldExpense) {
goToItem();
return;
}

However, allReportTransactions are not computed correctly:

const allReportTransactions = (
isReportListItemType(item)
? Object.entries(data)
.filter(([itemKey, value]) => itemKey.startsWith(ONYXKEYS.COLLECTION.REPORT) && (value as SearchTransaction)?.reportID === item.reportID)
.map((report) => report[1])

The above logic does not get the transactions from the report item but just get the report data itself.

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

For item of type ReportListItem, we already include all its transactions inside item.transactions.

const allReportTransactions = isReportListItemType(item) ? item.transactions : [data[`${ONYXKEYS.COLLECTION.TRANSACTION}${item.transactionID}`]];

@allgandalf
Copy link
Contributor

@gijoe0295 were you able to find the offending PR ?

@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Nov 25, 2024
@melvin-bot melvin-bot bot added the Overdue label Nov 25, 2024
@mountiny
Copy link
Contributor

cc @luacmartins can you have a look please

I dont think this is a blocker as the feature works its just a different UX to discuss

@luacmartins luacmartins self-assigned this Nov 25, 2024
@melvin-bot melvin-bot bot removed the Overdue label Nov 25, 2024
@luacmartins
Copy link
Contributor

I agree it doesn't need to be a blocker. I'll take a look at it since my PR introduced this feature

@trjExpensify
Copy link
Contributor

Just so I'm following along:

  • If you click Approve on a single-expense report when the expense is held, it opens the RHP.
  • If you click Approve on a multi-expense report when one of the expenses is held, it approves the report not opens the RHP.

So the second one is the bug, right?

@luacmartins
Copy link
Contributor

Yea, that second one should also open the RHP

@luacmartins luacmartins changed the title Search - Different approval behavior when approving one held expense vs multiple held expenses [Search v1.2] - Different approval behavior when approving one held expense vs multiple held expenses Nov 26, 2024
@melvin-bot melvin-bot bot added the Overdue label Nov 29, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

@trjExpensify, @luacmartins Huh... This is 4 days overdue. Who can take care of this?

@luacmartins
Copy link
Contributor

Working on it this week

@melvin-bot melvin-bot bot removed the Overdue label Dec 3, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 5, 2024
@luacmartins
Copy link
Contributor

PR in review

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 12, 2024
@melvin-bot melvin-bot bot changed the title [Search v1.2] - Different approval behavior when approving one held expense vs multiple held expenses [HOLD for payment 2024-12-19] [Search v1.2] - Different approval behavior when approving one held expense vs multiple held expenses Dec 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Dec 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.74-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-12-19. 🎊

Copy link

melvin-bot bot commented Dec 12, 2024

@luacmartins @trjExpensify @luacmartins The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

7 participants