Repository navigation
fix: Approve and Reject options are not available for Admin after changing workspace - #82823
Conversation
|
@DylanDylann 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4021ca61db
ℹ️ 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".
|
@nkdengineer However, I'm not sure if the logic in getNextApproverAccountID is correct when we change the workspace. Consider this case: the approval chain in the admin workspace is Approver A → Employee → Approver B. When changing the report to the admin workspace, getNextApproverAccountID returns Approver B. Is this correct? Or should approval start from the first approver (Approver A) when switching to a new workspace? |
|
@cead22 Can you please confirm what should be the expected in the case above? |
|
I'm not sure I understand, so it'd be helpful to spell out the whole config and flow.
If I understand correctly, and the report belongs to But |
|
In the admin workspace: First approver: Approver A And the employee moves their expense (from employee's workspace) to the admin workspace chat |
|
@cead22 I thought of this case because @nkdengineer is using getNextApproverAccountID to get the managerID for submitted expense reports when changing workspaces. When changing the workspace of a submitted expense, I think we should point it to the first approver of the new workspace |
Can you share a screenshot or the policy.employeeList for this? |
|
First approver: Admin : dylandylan9112+200134253600@gmail.com
|
|
In the backend PR, we're do the following int64_t newPolicyApproverID = auth.policy.getSubmitsTo(db, policyID, submitterEmail);
...
newManagerID = newPolicyApproverID;This is in line with what you're saying 👍. I assumed Looking at the code, it seems to me like it should return the report's managerID from here https://github.com/Expensify/App/blob/1fd4f51f927/src/libs/ReportUtils.ts#L4721, is that not the case? |
@nkdengineer You're missing isUnapproved. Please add it and verify that this scenario works correctly. |
@DylanDylann |
@cead22 This is not my case because |
|
@cead22 Any thought on the comment from Dylan above? |
|
I'm not sure what I'm being asked. I think we need to update getNextApproverAccountID to return the correct managerID, right? If not, then there must be another function that we can use for this. Is that the case? |
|
Bump @nkdengineer |
|
I will check this today |
|
@nkdengineer Could you also merge latest main? |
PR ReviewThe approach is sound — resetting Issues to address1. Unnecessary const newManagerAccountID = getManagerAccountID(policy, report);2. Inline const shouldResetApprovalChain = isProcessingReport(report) && newManagerAccountID !== report.managerID;
if (shouldResetApprovalChain) {3. Potential conflict with the "manager not in new policy" block (lines 6587-6612)
Since both push separate Consider either:
Minor nitThe Overall: Logic is on the right track. Please address the open review comments from |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20f0f2797a
ℹ️ 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".
Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com>
|
@DylanDylann Updated. |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-04-07.at.13.59.03.movAndroid: mWeb ChromeScreen.Recording.2026-04-07.at.14.00.11.moviOS: HybridAppScreen.Recording.2026-04-07.at.13.57.18.moviOS: mWeb SafariScreen.Recording.2026-04-07.at.13.58.48.movMacOS: Chrome / SafariScreen.Recording.2026-04-07.at.13.56.26.mov |
|
@nkdengineer Looks like the issue can't be reproduced on main anymore. Could you help to verify if this fix is necessary now? Screen.Recording.2026-04-07.at.14.13.04.mov |
|
@DylanDylann Still can reproduce this issue on the latest main. Screen.Recording.2026-04-07.at.14.42.30.mov |
|
@nkdengineer Oops, your steps here are different from what you described in the PR description. Could you update the test steps to reflect the correct changes? |
@DylanDylann What is the different? |
|
Ah sorry, we merged a BE PR before to fix on the admin side |
|
🚧 @cead22 has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ 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/cead22 in version: 9.3.55-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a bug fix that corrects the approval chain logic when changing a report's workspace — specifically, it resets the |
|
🚀 Deployed to staging by https://github.com/cead22 in version: 9.3.57-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This PR fixes a bug in the approval chain logic when changing workspaces on expense reports ( These changes are purely internal bug fixes — they don't alter any user-facing feature names, workflows, settings, or UI labels that would be documented in |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.57-1 🚀
|

Explanation of Change
Fixed Issues
$ #80582
PROPOSAL: #80582 (comment)
Tests
Preconditions: Create an Admin and a Member, selecting "Manage my team's expenses" option
Approvebutton doesn't appear, and the next step isWaiting for admin to approve the expenseOffline tests
None
QA Steps
Same as test
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
Screen.Recording.2026-02-18.at.22.46.41.mov
Android: mWeb Chrome
Screen.Recording.2026-02-18.at.22.47.49.mov
iOS: Native
Screen.Recording.2026-02-18.at.22.45.32.mov
iOS: mWeb Safari
Screen.Recording.2026-02-18.at.22.49.07.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-18.at.22.42.20.mp4