-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix: Hold option still appear when first approver approved #82092
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
base: main
Are you sure you want to change the base?
Conversation
|
@thesahindia 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] |
| const isProcessingReport = isProcessingReportUtils(report); | ||
|
|
||
| return isProcessingReport; | ||
| return isProcessingReport && isAwaitingFirstLevelApproval(report); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ PERF-2 (docs)
The expression isProcessingReport && isAwaitingFirstLevelApproval(report) results in redundant computation. The isAwaitingFirstLevelApproval function (defined in ReportUtils.ts:2023) internally calls isProcessingReport(report) again. This means when isProcessingReport is true, the function will be called twice.
Suggested fix:
Since isAwaitingFirstLevelApproval already checks isProcessingReport internally, you can remove the redundant check:
const isProcessingReport = isProcessingReportUtils(report);
return isAwaitingFirstLevelApproval(report);Or, to make the logic more explicit and avoid the internal redundancy, you could refactor to:
if (!isProcessingReportUtils(report)) {
return false;
}
const submitsToAccountID = getSubmitToAccountID(getPolicy(report.policyID), report);
return submitsToAccountID === report.managerID;Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69f2f8ecc8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const isProcessingReport = isProcessingReportUtils(report); | ||
|
|
||
| return isProcessingReport; | ||
| return isProcessingReport && isAwaitingFirstLevelApproval(report); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep HOLD available to manager/admin after first approval
This new gate hides HOLD whenever isAwaitingFirstLevelApproval(report) is false, which also happens after a report is forwarded to a second approver. In that state, the current approver (report.managerID) and policy admins can still legitimately hold the expense according to canHoldUnholdReportAction() (it allows hold for submitted reports when canModifyStatus is true), so this change removes a previously valid action for multi-level approval flows rather than only removing it for the original submitter.
Useful? React with 👍 / 👎.
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good from product 👍
Explanation of Change
Fixed Issues
$#78264
PROPOSAL:#78264 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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
android.mp4
Android: mWeb Chrome
android-mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios-mweb.mp4
MacOS: Chrome / Safari
web.mp4