Fix: Approver Field Disappearing and “Expense From” Expanding When Approver Is Removed#75646
Conversation
…se from' behavior when approver is removed
|
@linhvovan29546 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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@nabi-ebrahimi Please use a |
@linhvovan29546, thanks for the feedback, applied. |
trjExpensify
left a comment
There was a problem hiding this comment.
No qualms with the bug fix 👍
P.S Can you try to make your PR titles more reflective of what code changes the PR is making / fill out the explanation of changes section? Thanks!
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-11-21.at.11.24.37.movAndroid: mWeb ChromeScreen.Recording.2025-11-21.at.11.25.54.moviOS: HybridAppScreen.Recording.2025-11-21.at.11.19.50.moviOS: mWeb SafariScreen.Recording.2025-11-21.at.11.21.36.movMacOS: Chrome / SafariScreen.Recording.2025-11-21.at.11.10.43.movMacOS: DesktopScreen.Recording.2025-11-21.at.11.16.50.mov |
There was a problem hiding this comment.
@nabi-ebrahimi Could you please update the description and title based on this comment: #75646 (review)?
Also, could you please add a unit test? The idea is that we should not call updateApprovalWorkflow or removeApprovalWorkflowAction for non approver when removeUsers is called in this case.
|
@nabi-ebrahimi Any progress? Please let me know if you need any help. |
|
@linhvovan29546 Sorry for the late reply — I was writing the unit tests. It looks like the logic has already been removed from the main branch. Here is the current App/src/pages/workspace/WorkspaceMembersPage.tsx Lines 201 to 212 in 1038561 |
|
@linhvovan29546, what is the next step for this PR? |
|
Okay, I see. They removed that logic in this PR: #73676. It looks like this introduced a bug, so we no longer update the workspace owner to an approver. |
|
@nabi-ebrahimi You should be able to now proceed as normal. Let me know if you have any questions. |
|
@linhvovan29546, the failing type checks aren’t related to my changes—they appear to have come from this PR and Commit |
|
@linhvovan29546, the PR is now finalized, and I’ve added the unit test as requested. Could you please take another look when you have time? Thank you very much! |
|
@nabi-ebrahimi Oops, I don’t think the test is correct. The test you added is |
src/libs/WorkflowUtils.ts
Outdated
| * Runs the logic that handles workflow updates for each approver being removed. | ||
| * Extracted for unit testing. | ||
| */ | ||
| function removeApproveWorkflows(args: RemoveApproveWorkflowsParams) { |
There was a problem hiding this comment.
I think the name should be removeApprovalWorkflows
There was a problem hiding this comment.
Or, to make it easier, you can revert/remove the changes to reduce the amount of code modified, similar to this commit da0824c? So we only need to change one place WorkspaceMembersPage.
src/libs/WorkflowUtils.ts
Outdated
| approvalWorkflows: ApprovalWorkflow[]; | ||
| }; | ||
|
|
||
| /** |
There was a problem hiding this comment.
/**
* Handles the removal or update of approval workflows when members who are approvers are being removed.
* For each approver being removed, this function either removes their workflows entirely or updates
* them by reassigning to the workspace owner.
*/
|
@linhvovan29546, thanks for the review. based on this
Just to confirm, do you mean that we no longer need the unit test and should revert/remove my changes back to da0824c. Thank you for the clarification. |
|
We still need ui test and only modify |
@linhvovan29546 ui test for the whole page or some specific test cases? |
For this specific test case |
|
@linhvovan29546, the PR is ready for your review. I’ve applied your feedback. Thanks! |
linhvovan29546
left a comment
There was a problem hiding this comment.
LGTM! I have two minor feedback
tests/ui/WorkspaceMembersTest.tsx
Outdated
| }); | ||
|
|
||
| describe('Removing members who are approvers and non-approvers', () => { | ||
| it('should not call workflow actions when removing only non-approvers', async () => { |
There was a problem hiding this comment.
The test name says "should not call" but the expectations verify that the functions ARE called. This is contradictory. So this should be should call workflow actions once when removing multiple members including an approver
|
|
||
| await waitForBatchedUpdatesWithAct(); | ||
|
|
||
| expect(updateWorkflowDataOnApproverRemoval).toHaveBeenCalledTimes(1); |
There was a problem hiding this comment.
Add comment // Verify workflow actions are only called once when an approver is removed
|
@linhvovan29546, thanks for the review, applied latest feedback. thanks |
inimaga
left a comment
There was a problem hiding this comment.
Looks good. Thanks both!
|
✋ 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/inimaga in version: 9.2.73-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.2.73-5 🚀
|
Explanation of Change
Update the
removeUsersfunction inWorkspaceMembersPage.tsxto only process workflow updates for actual approvers among the selected employees.Fixed Issues
$ #74728
PROPOSAL: #74728 (Coment)
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
// TODO: These must be filled out, or the issue title must include "[No QA]."
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.1404-08-29.at.2.12.08.PM.mov
Android: mWeb Chrome
Screen.Recording.1404-08-29.at.1.18.12.PM.mov
iOS: Native
Screen.Recording.1404-08-29.at.2.07.27.PM.mov
iOS: mWeb Safari
Screen.Recording.1404-08-29.at.1.14.01.PM.mov
MacOS: Chrome / Safari
Screen.Recording.1404-08-29.at.1.10.32.PM.mov
MacOS: Desktop
Screen.Recording.1404-08-29.at.1.07.32.PM.mov