Allow inviting new users in the Add approval workflow flow#75589
Conversation
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.
|
|
@hoangzinh since this is a new feature, I will upload all platform recordings once i address any comments / code suggestions you may leave after your review. This helps in avoiding regressions since the PR is tested with new changes, let me know if you require videos before you start testing, looking for your review 😄 |
|
@hoangzinh 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] |
|
Implementation video for reference Screen.Recording.2025-11-20.at.1.59.29.AM.mov |
|
@JmillsExpensify has been on this one, so switching us out. |
|
@twilight2294, can you check code review feedbacks above? |
|
I'd like to test an adhoc when we get through C+ review. |
|
@hoangzinh PR is ready for your review |
| const policyName = policy?.name; | ||
|
|
||
| const headerTitle = useMemo(() => { | ||
| if (backTo && typeof backTo === 'string' && backTo.includes('expenses-from')) { |
There was a problem hiding this comment.
Can we put this one into a variable backTo && typeof backTo === 'string' && backTo.includes('expenses-from') ? And reuse it from below
There was a problem hiding this comment.
Can we put expenses-from into CONST as well? (also use it to generate WORKSPACE_WORKFLOWS_APPROVALS_EXPENSES_FROM.route as well)
| } | ||
|
|
||
| // If backTo is provided and it's not the members page, navigate back to it | ||
| if (backTo && !(backTo as string).endsWith('members')) { |
There was a problem hiding this comment.
I think we should check 'expenses-from' ROUTE only and goBack to avoid hidden bugs
| // Note: We don't auto-navigate to the approver page after returning from invite | ||
| // The user should stay on this page to see their selected members and click "Next" manually |
There was a problem hiding this comment.
Which code does this comment explain for?
| const ineligibleInvites = getIneligibleInvitees(policy?.employeeList); | ||
| return ineligibleInvites.reduce( | ||
| (acc, login) => { | ||
| acc[login] = true; | ||
| return acc; | ||
| }, | ||
| {} as Record<string, boolean>, | ||
| ); |
There was a problem hiding this comment.
I think we can put this one into a sharable func
| const handleSearchChange = useCallback( | ||
| (term: string) => { | ||
| setSearchSelectorTerm(term); | ||
| }, | ||
| [setSearchSelectorTerm], | ||
| ); |
There was a problem hiding this comment.
why don't we use setSearchSelectorTerm directly instead of defining new handleSearchChange func?
| // Ensure avatars are only strings (URLs) or undefined, never React components | ||
| const allMembers: Member[] = [ | ||
| ...existingMembers.map((member) => ({ | ||
| ...member, | ||
| avatar: typeof member.avatar === 'string' ? member.avatar : undefined, | ||
| })), | ||
| ...usersToInvite.map((user) => ({ | ||
| displayName: user.email, | ||
| email: user.email, | ||
| avatar: undefined, | ||
| })), | ||
| ]; | ||
| setApprovalWorkflowMembers(allMembers); |
There was a problem hiding this comment.
Do you think it's same with https://github.com/Expensify/App/pull/75589/files#diff-0a4739399b93f09a6f9466afba489945b2c9dc18700f579b75e71a0d6e9167ffR290-R298
If yes, we can move it to the top to apply for both usersToInvite.length > 0 and else
|
🚧 @JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
|
Kicked off an adhoc build |
This comment has been minimized.
This comment has been minimized.
|
Addressing the review today |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-12-25.at.04.26.26.android.movAndroid: mWeb ChromeScreen.Recording.2025-12-25.at.04.30.22.android.chrome.moviOS: HybridAppScreen.Recording.2025-12-25.at.04.41.53.ios.moviOS: mWeb SafariScreen.Recording.2025-12-25.at.04.36.47.ios.s.movMacOS: Chrome / SafariScreen.Recording.2025-12-25.at.04.15.08.web.mov |
|
@twilight2294 can you also add recordings for this issue? |
|
@hoangzinh i updated |
|
bump @hoangzinh , can you approve the PR please |
|
@twilight2294 I also have a minor feedback here https://github.com/Expensify/App/pull/75589/files#r2646258642 |
Co-authored-by: Vinh Hoang <hoangzinhvn@gmail.com>
|
@hoangzinh back to you |
|
✋ 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/youssef-lr in version: 9.2.91-0 🚀
|
|
@twilight2294 This PR is failing because of a regression issue #78775 . The issue is reproducible in: Web Bug7040498_1767351637415.2.mp4 |
|
Going to revert the pr due to bunch of minor issues, please try to address them all in v2 and include the testing steps in the Pr description please |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.2.91-1 🚀
|
Explanation of Change
Fixed Issues
$ #61625
PROPOSAL: #61625 (comment)
Tests
Offline tests
QA Steps
expenses fromsection, type a user who is not a member of the workspaceVerify that that user appears
Verify that an invite screen is shown
Verify that you are taken back to the
expenses fromrhpVerify that you are able to complete the flow successfully
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.2025-12-27.at.8.35.11.PM.mov
Android: mWeb Chrome
Screen.Recording.2025-12-27.at.8.35.52.PM.mov
iOS: Native
Simulator.Screen.Recording.-.Expensify.Testing.18.6.Pro.-.2025-12-27.at.18.53.54.mov
iOS: mWeb Safari
Simulator.Screen.Recording.-.Expensify.Testing.18.6.Pro.-.2025-12-27.at.18.54.41.mov
MacOS: Chrome / Safari
Screen.Recording.2025-12-27.at.6.50.07.PM.mov