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

Update correct next approver with category/tag rules #52537

Merged
merged 29 commits into from
Dec 19, 2024

Conversation

nkdengineer
Copy link
Contributor

@nkdengineer nkdengineer commented Nov 14, 2024

Explanation of Change

  • Update getApprovalChain to include category/tag rule approvers
  • getNextApproverAccountID already works as expected

Fixed Issues

$ #52458
PROPOSAL:

Tests

Precondition:

  • The workspace's rules are enabled, and the approval mode is ADVANCE
  • Has 4 approvers and 1 submitter
  • Setting two category approver rules (CAT1 and CAT2) for two approvers (approver 1 and approver 2) and two tag approver rules (TAG1 and TAG2) for two approvers (approver 3 and approver 4)
  1. [Submitter]: Submit 4 expenses that include categories CAT1 and CAT2, tags TAG1 and TAG2
  2. [Submitter]: Submit the expense report and verify that the next approver is the approver 1
  3. [Approver1]: Approve the expense and verify that the next approver is the approver 2
  4. [Approver2]: Approve the expense and verify that the next approver is the approver 3
  5. [Approver3]: Approve the expense and verify that the next approver is the approver 4
  6. [Approver4]: Approve the expense and verify that the next step is waiting admin for payment
  • With the same setting above, disable the approval
  1. [Submitter]: Create an expense and submit it
  2. Verify that no approval is needed and the expense is submitted successfully
  • Verify that no errors appear in the JS console

Offline tests

Same as above

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."
Precondition:

  • The workspace's rules are enabled, and the approval mode is ADVANCE
  • Has 4 approvers and 1 submitter
  • Setting two category approver rules (CAT1 and CAT2) for two approvers (approver 1 and approver 2) and two tag approver rules (TAG1 and TAG2) for two approvers (approver 3 and approver 4)
  1. [Submitter]: Submit 4 expenses that include categories CAT1 and CAT2, tags TAG1 and TAG2
  2. [Submitter]: Submit the expense report and verify that the next approver is the approver 1
  3. [Approver1]: Approve the expense and verify that the next approver is the approver 2
  4. [Approver2]: Approve the expense and verify that the next approver is the approver 3
  5. [Approver3]: Approve the expense and verify that the next approver is the approver 4
  6. [Approver4]: Approve the expense and verify that the next step is waiting admin for payment
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2024-11-26.at.12.43.40.mov
Android: mWeb Chrome
Screen.Recording.2024-11-20.at.14.28.34.mov
iOS: Native
Screen.Recording.2024-11-26.at.12.45.17.mov
iOS: mWeb Safari
Screen.Recording.2024-11-26.at.12.41.25.mov
MacOS: Chrome / Safari
Screen.Recording.2024-11-26.at.12.30.19.mov
Screen.Recording.2024-11-26.at.12.34.51.mov
Screen.Recording.2024-11-26.at.12.35.47.mov
Screen.Recording.2024-11-26.at.12.36.28.mov
Screen.Recording.2024-11-26.at.12.37.03.mov
MacOS: Desktop
Screen.Recording.2024-11-26.at.12.47.36.mov

@Beamanator
Copy link
Contributor

I spent a lot of time today fixing the backend, PR is up - but I didn't get to test your front end changes, sorry - if you can't find a bug with the correct approver when there's multiple category approvers, that's great! I will try to reproduce the issue i found on Monday 🙏

@nkdengineer
Copy link
Contributor Author

Got it, no problem.

@nkdengineer nkdengineer marked this pull request as ready for review November 26, 2024 05:57
@nkdengineer nkdengineer requested a review from a team as a code owner November 26, 2024 05:57
@melvin-bot melvin-bot bot requested review from ntdiary and removed request for a team November 26, 2024 05:57
Copy link

melvin-bot bot commented Nov 26, 2024

@ntdiary 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]

* Return the sorted list transactions of an iou report
*/
function getAllSortedTransactions(iouReportID: string): Array<OnyxEntry<Transaction>> {
// We need sort all transactions by sorting the parent report actions because `created` of the transaction only has format `YYYY-MM-DD` which can cause the wrong sorting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooohhh this is interesting, and maaay be wrong - but let's see.

What we need to test is (in OldDot):

  1. create 2 new expenses in a report with different category approvers
  2. The 1st created expense should have an expense date AFTER the date of the 2nd expense

Then, when the submitter submits the report, does the report go to the category approver on the first expense or the category approver on the 2nd expense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// We need sort all transactions by sorting the parent report actions because created of the transaction only has format YYYY-MM-DD which can cause the wrong sorting

@Beamanator Currently, we're going to the first expense. I think I need to update the comment a bit to

// We need to sort all transactions by sorting the parent report actions because `created` of the transaction doesn't mean the created time of the transaction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok well from my testing in OldDot, it honestly doesn't seem consistent, which order the category approvers show up when there's multiple 😅 So I'm discussing internally to figure out what we'll want to do in NewDot, as an expected order

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok Updated sort order is here: #52458 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems frontend also needs a tweak to achieve this sort order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still investigate the sort order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntdiary Updated the sort order.

@ntdiary
Copy link
Contributor

ntdiary commented Nov 27, 2024

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native 52537-android-native-submit 52537-android-native-approve-cat_1 52537-android-native-approve-cat_2 52537-android-native-approve-tag_3 52537-android-native-approve-tag_4
Android: mWeb Chrome 52537-android-chrome-submit 52537-android-chrome-approve-cat_1 52537-android-chrome-approve-cat_2 52537-android-chrome-approve-tag_3 52537-android-chrome-approve-tag_4
iOS: Native 52537-ios-native-submit 52537-ios-native-approve-cat_1 52537-ios-native-approve-cat_2 52537-ios-native-approve-tag_3 52537-ios-native-approve-tag_4
iOS: mWeb Safari 52537-ios-safari-submit 52537-ios-safari-approve-cat_1 52537-ios-safari-approve-cat_2 52537-ios-safari-approve-tag_3 52537-ios-safari-approve-tag_4
MacOS: Chrome / Safari
52537-mac-chrome-submit.mp4
52537-mac-chrome-approve-cat_1.mp4
52537-mac-chrome-approve-cat_2.mp4
52537-mac-chrome-approve-tag_3.mp4
52537-mac-chrome-approve-tag_4.mp4
MacOS: Desktop 52537-mac-desktop-submit 52537-mac-desktop-approve-cat_1 52537-mac-desktop-approve-cat_2 52537-mac-desktop-approve-tag_3 52537-mac-desktop-approve-tag_4

@ntdiary
Copy link
Contributor

ntdiary commented Nov 27, 2024

no.4.mov

Maybe this should be fixed as a frontend bug: When no.4 approves, the frontend optimistic message shows no further action required!, but the correct backend data is waiting for no.25 to approve. (no.25 is policy owner)
What do you think? cc @nkdengineer @Beamanator

@nkdengineer
Copy link
Contributor Author

@ntdiary Is this reproducible on the latest main? If yes, I think we should fix it as a separate issue.

@ntdiary
Copy link
Contributor

ntdiary commented Nov 28, 2024

@ntdiary Is this reproducible on the latest main? If yes, I think we should fix it as a separate issue.

The reason I'm asking here, is if we don't fix it, we can't achieve the expected behavior in the OP (step 12 offline):

[1] Expected Result:

  1. Confirm the second approver is Approver B (both offline & online)
  2. As Approver B, approve the report
  3. Confirm the third approver is workspace owner (both offline & online)
  4. As WS owner, approve and confirm that the report is final approved.

Additionally, this problem is introduced by PR #51196, the execution chain is:
approveMoneyRequestgetApprovalChaingetSubmitToEmailgetSubmitToAccountID. When approving, if there is a category approver in the chain, the first item in the chain was always the category approver, which caused the optimisticNextStep calculation to be incorrect.

BTW, when building the approval chain, I think Set may be more appropriate and simple than Array, as the elements are unique and ordered. If we don't want to make many changes, we can still return Array, since the conv is also quite simple:

const chain = new Set<String>()
approvers.forEach(el => chain.add(el))

chain.delete(submitterEmail)

a = new Set([1,3,2,4,3,2])
return [...a]

Finally, if needed, maybe we could increase the bounty for this issue, since it really involves quite multiple cases that need to be considered. :)

@Beamanator
Copy link
Contributor

I definitely think it's fair to bump the bounty on this one, it's a pretty complicated issue that we're trying to get perfect 👍

@ntdiary are you waiting on me or @nkdengineer to look at your latest message?

BTW I'm making sure a transaction inserted date gets back to Onyx, that should be ready in staging tomorrow at some point 🙏

@ntdiary
Copy link
Contributor

ntdiary commented Dec 4, 2024

@ntdiary are you waiting on me or @nkdengineer to look at your latest message?

@Beamanator, I’m waiting for the new sorting implementation,
image
and to see if this bug should be fixed. I personally think it should be fixed, because the expected behavior was mentioned in the OP, and in our case, the frontend didn't correctly add the owner to the full approval chain(i.e., rule approval chain + submitsTo/owner/forwards). 😄

@Beamanator
Copy link
Contributor

Cool, yeah @nkdengineer can now implement the correct sorting (with transaction inserted date - b/c that was just deployed yesterday)

and to see if #52537 (comment) should be fixed. I personally think it should be fixed, because the expected behavior was mentioned in the OP, and in our case, the frontend didn't correctly add the owner to the full approval chain(i.e., rule approval chain + submitsTo/owner/forwards). 😄

I think this makes sense too, to fix here 👍 i believe it should be a relatively quick fix 😅

@nkdengineer
Copy link
Contributor Author

Sure will give an update soon.

@ntdiary
Copy link
Contributor

ntdiary commented Dec 5, 2024

BTW, it would be great if we can add some unit tests for this feature, since we've recently started prioritizing unit test. :)
image
slack conv:
https://expensify.slack.com/archives/C01GTK53T8Q/p1733148961659549
https://expensify.slack.com/archives/C05LX9D6E07/p1733164389303049

@Beamanator
Copy link
Contributor

Ooh definitely agreed about tests 👍 though i wouldn't mind if that's in a follow-up just so we can get this out the door quicker 🤷

Copy link
Contributor

@ntdiary ntdiary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
The errors reported by ESLint are from code that we haven’t modified. :)

@melvin-bot melvin-bot bot requested a review from Beamanator December 18, 2024 13:55
@nkdengineer
Copy link
Contributor Author

@Beamanator Let's wait a bit. I just found a case that we cannot submit the report when the approval flow is disabled.


// If the policy is not on advanced approval mode, we should not use the approval chain even if it exists.
if (!PolicyUtils.isControlOnAdvancedApprovalMode(policy)) {
if (PolicyUtils.isSubmitAndClose(policy)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntdiary Clarify a bit, we need to return early if the approval mode is OPTIONAL then when the user submits the report, backend will not return error about the managerAccountID is incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can test with the case the step-up is the same with the original step except the approval mode is OPTIONAL. Then no.24 creates an expense with tag/category match with rule and submit the report.

Copy link
Contributor

@ntdiary ntdiary Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntdiary Clarify a bit, we need to return early if the approval mode is OPTIONAL then when the user submits the report, backend will not return error about the managerAccountID is incorrect.

Interesting, @nkdengineer, so you tried this case:

  1. enable Advanced Approval mode
  2. set category&tag rule approvers
  3. then switch to Submit and Close mode directly.

right?

image

Based on comments in PR #51196, I thought category/tag rule approvers were also supported in S&C mode. 😂
If the backend doesn't support it, I think your new early return is fine!

The frontend should be ready :shipit:. As for the unit tests, we’ve already confirmed before, If needed, can add them in a follow-up PR.
cc @Beamanator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh ok I will test that out in OldDot now to see what happens!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I just tested in OldDot and found that Category Approvers are NOT supported on Control, Submit & Close policies 🙏 - I honestly had never tested that, but glad it's tested now & it sounds like that's working in this PR 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, @nkdengineer, so you tried this case:

  1. enable Advanced Approval mode
  2. set category&tag rule approvers
  3. then switch to Submit and Close mode directly.

FYI I don't think it's important to run the test in this order - a.k.a. it's not important to enable advanced approval first, then switch to submit & close... Right?!?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I don't think it's important to run the test in this order - a.k.a. it's not important to enable advanced approval first, then switch to submit & close... Right?!?

@Beamanator, yeah, you are right! In OD web page, even in S&C mode, it is still possible to set category/tag approvers, although they won't take effect. :D

@Beamanator
Copy link
Contributor

@nkdengineer conflicts 🙏 I'm doing a final run through today, but seems we might be able to get this merged today!!

@nkdengineer
Copy link
Contributor Author

Update now.

@nkdengineer
Copy link
Contributor Author

@Beamanator Resolved conflict.

Copy link
Contributor

@Beamanator Beamanator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok looooooking good, just a few comments:

  1. So far the QA Steps only include tests for the Advanced approval mode. Please update to include tests for Submit & Approve and Submit & Close 🙏
    • I think it would be also smart to make a quick note that QA should test approval modes on Collect plans as well to make sure they're still working perfect
  2. There's actually another part which I think we are missing - which is basically: when building the approval chain, we should check if everyone in the chain has already approved or not - because it's possible for the order to get mixed up if someone approves, then the approval chain changes. This, however, I think I'll try to handle in a follow-up cuz it's a pretty annoying case & we should get this one out the door 😅

return [...categoryAppovers, ...tagApprovers];
}

function getManagerAccountID(policy: OnyxEntry<Policy> | SearchPolicy, expenseReport: OnyxEntry<Report>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're getting the NEXT manager account ID, right? Can we call this function something like getNextManagerAccountID & rename getManagerAccountEmail to something like getNextManagerAccountEmail?

The way I currently read these functions is that we should be getting the report's current manager account ID / email - which I don't believe is true


// Push rule approvers to approvalChain list before submitsTo/forwardsTo approvers
ruleApprovers.forEach((ruleApprover) => {
// Don't push submiiter to approve as a rule approver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Don't push submiiter to approve as a rule approver
// Don't push submitter to approve as a rule approver

@Beamanator Beamanator merged commit 173db36 into Expensify:main Dec 19, 2024
17 of 18 checks passed
@melvin-bot melvin-bot bot added the Emergency label Dec 19, 2024
Copy link

melvin-bot bot commented Dec 19, 2024

@Beamanator looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@Beamanator
Copy link
Contributor

Failing test was esLint errors unrelated to these changes, so not an Emergency

1 similar comment
@Beamanator
Copy link
Contributor

Failing test was esLint errors unrelated to these changes, so not an Emergency

@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 cancelled 🔪
🖥 desktop 🖥 cancelled 🔪
🍎 iOS 🍎 cancelled 🔪
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 cancelled 🔪
🍎🔄 iOS HybridApp 🍎🔄 cancelled 🔪

Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

2 similar comments
Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

1 similar comment
Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to staging by https://github.com/Beamanator in version: 9.0.78-0 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.78-6 🚀

platform result
🤖 android 🤖 true ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants