Clear hold reason of all transactions when the admin approves all requests#39579
Clear hold reason of all transactions when the admin approves all requests#39579robertjchen merged 10 commits intoExpensify:mainfrom
Conversation
|
@hoangzinh Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@hoangzinh Actually, after we hold the request, the app crashes the context here. To test locally, we can update these like this |
src/libs/actions/IOU.ts
Outdated
| key: `${ONYXKEYS.COLLECTION.TRANSACTION}${heldTransaction.transactionID}`, | ||
| value: { | ||
| comment: { | ||
| ...heldTransaction.comment, |
There was a problem hiding this comment.
I think we don't need to push current value of heldTransaction.comment
src/libs/actions/IOU.ts
Outdated
| key: `${ONYXKEYS.COLLECTION.TRANSACTION}${heldTransaction.transactionID}`, | ||
| value: { | ||
| comment: { | ||
| ...heldTransaction.comment, |
src/libs/actions/IOU.ts
Outdated
| let total = expenseReport.total ?? 0; | ||
| if (ReportUtils.hasHeldExpenses(expenseReport.reportID) && !full && !!expenseReport.unheldTotal) { | ||
| const transactions = TransactionUtils.getAllReportTransactions(expenseReport.reportID); | ||
| const hasHeldExpenses = transactions.some((transaction) => TransactionUtils.isOnHold(transaction)); |
There was a problem hiding this comment.
I think it's better if we keep use ReportUtils.hasHeldExpenses util to check report has held expenses. We might need to write a new util to get heldExpenses of a report.
There was a problem hiding this comment.
Because ReportUtils.hasHeldExpenses also get all transaction and use it to check the held request and we also use allTransactions here to get the heldTransactions, so I not use ReportUtils.hasHeldExpenses to prevent call getAllReportTransactions two times.
There was a problem hiding this comment.
I think it's not worth to duplicate code ReportUtils.hasHeldExpenses here. If we put more logic into ReportUtils.hasHeldExpenses later, those line of codes would be outdated
src/libs/actions/IOU.ts
Outdated
| ]; | ||
|
|
||
| // Clear hold reason of all transactions if we approve all requests | ||
| const heldTransactions = ReportUtils.getAllHeldTransactions(expenseReport.reportID); |
There was a problem hiding this comment.
@nkdengineer what do you think if we split this into a const and use it to check here? Something like this
Line 4637 in eeccc2b
const hasHeldExpenses = ReportUtils.hasHeldExpenses(expenseReport.reportID)
...
// Clear hold reason of all held transactions if we approve all requests
if (full & hasHeldExpenses) {
const heldTransactions = ReportUtils.getAllHeldTransactions(expenseReport.reportID);
...
}
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-04-11.at.15.46.57.android.movAndroid: mWeb ChromeScreen.Recording.2024-04-11.at.15.27.32.android.chrome.moviOS: NativeScreen.Recording.2024-04-11.at.15.33.22.ios.moviOS: mWeb SafariScreen.Recording.2024-04-11.at.15.36.27.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2024-04-10.at.19.55.30.web.movMacOS: DesktopScreen.Recording.2024-04-11.at.09.03.44.desktop.mov |
|
@nkdengineer can you try to merge latest main if it fix perf-test? |
|
@hoangzinh Fixed now. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/robertjchen in version: 1.4.63-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀
|
Details
Clear hold reason of all transactions when the admin approves all requests
Fixed Issues
$ #39342
PROPOSAL: #39342 (comment)
Tests
Precondition: The admin have the collect workspace and invite some users as employee
Offline tests
Precondition: Do step 1-3 online
Do step 4 - 6 offline
QA Steps
Precondition: The admin have the collect workspace and invite some users as employee
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2024-04-04.at.14.31.10.mov
Android: mWeb Chrome
Screen.Recording.2024-04-04.at.14.23.22.mov
iOS: Native
Screen.Recording.2024-04-04.at.14.32.28.mov
iOS: mWeb Safari
Screen.Recording.2024-04-04.at.14.27.38.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-04.at.13.37.46.mov
MacOS: Desktop
Screen.Recording.2024-04-04.at.14.35.24.mov