Repository navigation
Fix: Filter Expensify team members and invoice display in Copy/Duplicate flows - #92777
yuwenmemon merged 13 commits into
Conversation
…kspace The member count was showing incorrect values because it included Expensify guides/account managers that are automatically assigned to workspaces. This fix adds a getFilteredMemberCount utility that applies the same filtering logic used in WorkspaceMembersPage. Fixes Expensify#91833
Tests cover: - Filtering Expensify guides (team.expensify.com) - Filtering Expensify employees (expensify.com) - No filtering when policy owner is Expensify team member - No filtering when current user is Expensify team member - Edge cases: undefined/empty employeeList, undefined owner/login
…count-expensify-team-filter
Apply the same fix to the Copy Policy Settings Select Features page to filter out Expensify guides/account managers from the member count.
…rsPage Refactored WorkspaceMembersPage to use the centralized shouldFilterExpensifyTeam utility function instead of inline logic. This ensures the Expensify team member filtering logic is consistent across: - WorkspaceMembersPage (member list) - WorkspaceDuplicateSelectFeaturesForm (duplicate workspace) - CopyPolicySettingsSelectFeaturesPage (copy settings) Any future changes to the filtering logic only need to be made in one place.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
…rsPage Refactored WorkspaceMembersPage to use the centralized shouldFilterExpensifyTeam utility function instead of inline logic. This ensures the Expensify team member filtering logic is consistent across: - WorkspaceMembersPage (member list) - WorkspaceDuplicateSelectFeaturesForm (duplicate workspace) - CopyPolicySettingsSelectFeaturesPage (copy settings) Any future changes to the filtering logic only need to be made in one place.
…ub.com:fedirjh/ExpensiApp into fedirjh/fix-member-count-expensify-team-filter
…ry re-renders - Add createFilteredMemberCountSelector to PolicyUtils for use with useOnyx - Update WorkspaceDuplicateSelectFeaturesForm and CopyPolicySettingsSelectFeaturesPage to use the selector instead of subscribing to the entire PERSONAL_DETAILS_LIST - Rename and update tests to test the new selector function
…nvoice display Centralize the logic for formatting invoice configuration text (bank accounts + company info) into a reusable selector. Both Copy Settings and Duplicate Workspace pages now use this selector to ensure consistent display of invoice information.
|
@fedirjh conflicts |
|
@yuwenmemon looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
🚧 @yuwenmemon has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.1-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Help site review: no documentation changes required. I reviewed the changes in this PR against the help articles under Why:
Both changes correct values that were already being displayed — they don't add features, rename UI, or change any documented behavior. Docs checked:
Since this fix only makes already-shown numbers accurate, there's no user-facing documentation to add or correct. No draft PR was created. @fedirjh, if you believe a doc should describe this behavior (e.g. a note that workspace member counts exclude Expensify guides), let me know and I'll draft one. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.1-6 🚀
|
Explanation of Change
This PR fixes bugs where the Members row and Invoices row on the Copy Settings and Duplicate Workspace pages were showing incorrect information.
Member Count Bug:
The Members row was showing an incorrect member count (e.g., showing 2 members when there was only 1). This happened because Expensify guides/account managers that are automatically assigned to workspaces were being included in the count.
Invoice Configuration Bug:
The Invoices row was showing inconsistent bank account counts between the Copy Settings and Duplicate Workspace pages. The duplicate flow was using
getEligibleExistingBusinessBankAccountswhich filters by currency and verification status, while the invoices page itself shows all business bank accounts regardless of these factors.Changes:
createFilteredMemberCountSelector()inPolicyUtils.ts- a selector that filters out Expensify team members when counting workspace memberscreateInvoiceConfigurationTextSelector()inPolicyUtils.ts- a selector that returns formatted text for invoice configuration (bank accounts count + company info), matching the filtering logic used by the invoices pageWorkspaceDuplicateSelectFeaturesForm.tsxto use both new selectorsCopyPolicySettingsSelectFeaturesPage.tsxto use both new selectorsWorkspaceMembersPage.tsxto use the centralizedshouldFilterExpensifyTeam()functionThe filtering/formatting logic is now centralized so that:
isExpensifyTeam(email)- checks if email domain isexpensify.comorteam.expensify.comshouldFilterExpensifyTeam(policyOwner, currentUserLogin)- returnstrueif Expensify team should be filteredcreateFilteredMemberCountSelector()- returns member count excluding Expensify teamcreateInvoiceConfigurationTextSelector()- returns formatted invoice text (e.g., "2 bank accounts, Company Name, example.com")All pages now use the same centralized logic, ensuring consistency and making future maintenance easier.
Fixed Issues
$ #91833
$ #91821
Tests
Member Count Tests:
Invoice Configuration Tests:
Offline tests
N/A - This is a display-only change that doesn't involve network requests.
QA Steps
Member Count:
Invoice Configuration:
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
CleanShot.2026-06-05.at.15.26.51.mp4
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari