-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Advanced approvals] Add optimistic steps for advanced approvals #44940
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
Changes from all commits
c1a5e67
a8e29ef
a9afa16
a7adbba
38c65d0
5500e9c
a4fdf8e
bae63de
5aa1ce9
b08590d
a697d1b
ae18457
c2f2352
5f2be76
d387a8e
2e5612c
0d5ce30
7f0d770
a78ce47
ecbbbaa
43edb0b
8787b3f
1bbbc24
7f5885c
1fea5ea
cd89b9e
38441ea
dcb4926
ab691ac
05f5276
916ba40
c5bd485
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7483,6 +7483,23 @@ function isExported(reportActions: OnyxEntry<ReportActions>) { | |
| return Object.values(reportActions).some((action) => ReportActionsUtils.isExportIntegrationAction(action)); | ||
| } | ||
|
|
||
| function getApprovalChain(policy: OnyxEntry<Policy>, employeeAccountID: number, reportTotal: number): string[] { | ||
| const approvalChain: string[] = []; | ||
|
|
||
| // If the policy is not on advanced approval mode, we should not use the approval chain even if it exists. | ||
| if (!PolicyUtils.isControlOnAdvancedApprovalMode(policy)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB - Maybe in a follow-up we can change this to only checking if the policy is not on advanced approval mode - it shouldn't matter if it's control or not (currently advanced approval is only available in control, but this "technically" could change at some point, and we'd have to update this)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ohhh shoot i used an existing function. i should have asked
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will fix in a follow up |
||
| return approvalChain; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB - Eventually we should change this to return the policy's default approver in this case. But not needed at this exact moment probably since we only call this function for advanced approval policies i believe
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah here some cleanup would be fine. i didn't want the function to be used by non advanced policy otherwise we'll have to test every flow |
||
| } | ||
|
|
||
| let nextApproverEmail = PolicyUtils.getSubmitToEmail(policy, employeeAccountID); | ||
|
|
||
| while (nextApproverEmail && !approvalChain.includes(nextApproverEmail)) { | ||
| approvalChain.push(nextApproverEmail); | ||
| nextApproverEmail = PolicyUtils.getForwardsToAccount(policy, nextApproverEmail, reportTotal); | ||
| } | ||
| return approvalChain; | ||
| } | ||
|
|
||
| export { | ||
| addDomainToShortMention, | ||
| completeShortMention, | ||
|
|
@@ -7778,6 +7795,7 @@ export { | |
| getReport, | ||
| getReportNameValuePairs, | ||
| hasReportViolations, | ||
| getApprovalChain, | ||
| isIndividualInvoiceRoom, | ||
| }; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.