Filter members with existing workflows from new approval picker#84617
Filter members with existing workflows from new approval picker#84617
Conversation
Members already assigned to non-default approval workflows were appearing in the "Expenses from" picker when creating a new workflow. Filter them out in addApprovalAction while leaving the edit flow unchanged (it uses mergeWorkflowMembersWithAvailableMembers). Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
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.
|
| // Filter out members who are already assigned to a non-default approval workflow. | ||
| // This prevents them from appearing in the "Expenses from" picker when creating a new workflow. | ||
| // The edit flow is unaffected as it uses mergeWorkflowMembersWithAvailableMembers separately. | ||
| const availableMembersForNewWorkflow = useMemo(() => { |
There was a problem hiding this comment.
@MelvinBot, move this function to WorkflowUtils.ts
There was a problem hiding this comment.
Done — extracted the filtering logic into filterAvailableMembersForNewWorkflow in WorkflowUtils.ts and updated the page to call it.
Extract filterAvailableMembersForNewWorkflow from WorkspaceWorkflowsPage into WorkflowUtils.ts as a standalone utility function. Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
|
@MelvinBot, add unit tests for this |
Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
|
Done — added 6 unit tests for
All 54 tests in the file pass. |
|
The failing check is unrelated to this PR. Analysis: The Evidence:
The test should pass on a re-run, or the flaky test needs a separate fix. |
|
@MelvinBot, pull latest main, resolve conflicts and push the changes here |
…WorkflowMembers Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
|
Merged latest |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-03-12.at.17.51.19.movAndroid: mWeb ChromeScreen.Recording.2026-03-12.at.17.46.12.moviOS: HybridAppScreen.Recording.2026-03-12.at.17.52.19.moviOS: mWeb SafariScreen.Recording.2026-03-12.at.17.52.58.movMacOS: Chrome / SafariScreen.Recording.2026-03-12.at.17.44.29.mov |
|
The failing check is unrelated to this PR. Analysis: The Evidence: The exact same |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
@MelvinBot, mark this as ready for review |
|
Done — PR has been marked as ready for review. |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #84379 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@eVoloshchak 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] |
|
Asking about this here |
Explanation of Change
When creating a new approval workflow via Workspace > Workflows > Add approval, the "Expenses from" member picker was showing all workspace members including those already assigned to a non-default approval workflow. This caused members to appear as selectable even though they already had an existing approval flow.
The fix adds a
useMemoinWorkspaceWorkflowsPage.tsxthat filtersavailableMembersto exclude members who are already part of a non-default workflow before passing the list tosetApprovalWorkflow()in theaddApprovalActioncallback. The edit flow remains unaffected since it usesmergeWorkflowMembersWithAvailableMembersseparately inWorkspaceWorkflowsApprovalsEditPage.tsx.Fixed Issues
$ #84379
PROPOSAL: #84379 (comment)
Tests
Offline tests
N/A — This change only affects client-side filtering of the member list when creating a new approval workflow. No network requests are involved in the filtering logic.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
N/A — no UI changes, logic-only filtering fix
Android: mWeb Chrome
N/A — no UI changes, logic-only filtering fix
iOS: Native
N/A — no UI changes, logic-only filtering fix
iOS: mWeb Safari
N/A — no UI changes, logic-only filtering fix
MacOS: Chrome / Safari
N/A — no UI changes, logic-only filtering fix