Skip to content

feat: Added role filter to workspace members list#88293

Merged
srikarparsi merged 19 commits intoExpensify:mainfrom
Uzaifm127:feat/87907
May 4, 2026
Merged

feat: Added role filter to workspace members list#88293
srikarparsi merged 19 commits intoExpensify:mainfrom
Uzaifm127:feat/87907

Conversation

@Uzaifm127
Copy link
Copy Markdown
Contributor

@Uzaifm127 Uzaifm127 commented Apr 19, 2026

Explanation of Change

This PR introduces a role-based member filter to the Workspace Members page, aligning it with the behavior already available on the domain members page.

Previously, users could not filter members by role, so this changes resolves that by:

  • Adding a role filter dropdown with options:
    • Control workspaces: All members, Admins, Approvers, Auditors
    • Collect workspaces: All members, Admins, Approvers
  • Setting “All members” as the default selection
  • The role filter is applied before the existing search
  • Supporting both layouts:
    • Filter only (when search bar is hidden)
    • Filter + search (when search bar is visible)

Fixed Issues

$ #87907
PROPOSAL: #87907 (comment)

Tests

  1. Open the app or go to https://staging.new.expensify.com
  2. Navigate to Workspace Settings > Members
  3. Verify that the role filter dropdown is visible when there is at least one member
  4. Verify that the default selected value is “All members”
  5. Open the dropdown and verify that the options:
    • For Control workspace: All members, Admins, Approvers, Auditors
    • For Collect workspace: All members, Admins, Approvers
  6. Select any filter and verify that only the filtered options are shown.
  7. Verify that if workspace members are below the search limit then search bar is hidden otherwise it will be shown next to the filter.
  8. Apply a role filter and then search for a member.
  9. Verify that the search results are scoped within the selected role.
  10. Select a role where no members exist.
  11. Verify that the empty state is shown with:
    • Title: No members match this filter
    • Subtitle: Invite a member or change the filter above.
  • Verify that no errors appear in the JS console

Offline tests

Same as Test

QA Steps

Same as Test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android-native.mov
Android: mWeb Chrome
android-mWeb.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-safari.mov
MacOS: Chrome / Safari
macOS.mov

@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Apr 19, 2026

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@Uzaifm127 Uzaifm127 changed the title feat: Added role filter to workspace members list [WIP] feat: Added role filter to workspace members list Apr 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/pages/workspace/WorkspaceMembersPage.tsx 61.20% <67.18%> (+0.21%) ⬆️
... and 3016 files with indirect coverage changes

@Uzaifm127 Uzaifm127 changed the title [WIP] feat: Added role filter to workspace members list feat: Added role filter to workspace members list Apr 20, 2026
@Uzaifm127 Uzaifm127 marked this pull request as ready for review April 20, 2026 09:41
@Uzaifm127 Uzaifm127 requested review from a team as code owners April 20, 2026 09:41
@melvin-bot melvin-bot Bot requested review from FitseTLT and trjExpensify and removed request for a team April 20, 2026 09:41
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented Apr 20, 2026

@FitseTLT 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]

@melvin-bot melvin-bot Bot removed request for a team and trjExpensify April 20, 2026 09:41
Comment thread src/pages/workspace/WorkspaceMembersPage.tsx Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad5a7f99a7

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pages/workspace/WorkspaceMembersPage.tsx Outdated
@Uzaifm127
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@FitseTLT
Copy link
Copy Markdown
Contributor

@shawnborton can u review this?

@FitseTLT
Copy link
Copy Markdown
Contributor

@Uzaifm127 the old filter list appears briefly with empty state graphics when filter is changed.

2026-04-23.18-20-12.mp4

@shawnborton
Copy link
Copy Markdown
Contributor

Sure, will run a test build.

@github-actions
Copy link
Copy Markdown
Contributor

🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here.

@FitseTLT
Copy link
Copy Markdown
Contributor

@shawnborton is the position of no items found text correct? or it should be below the text box?
image

@FitseTLT
Copy link
Copy Markdown
Contributor

@Uzaifm127 one last bug related with debounced value because this line

if (filteredData.length === 0) {
return null;

using non-debounced data it is causing the header disappear before the list is empty

@dubielzyk-expensify
Copy link
Copy Markdown
Contributor

@shawnborton is the position of no items found text correct? or it should be below the text box?

That looks correct. It's meant to be in place of the table or results themselves which is where it sits currently

@shawnborton
Copy link
Copy Markdown
Contributor

Yeah that works for me 👍

@Uzaifm127
Copy link
Copy Markdown
Contributor Author

@FitseTLT This is done.

using non-debounced data it is causing the header disappear before the list is empty

@@ -881,7 +991,11 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers
canSelectMultiple={canSelectMultiple}
turnOnSelectionModeOnLongPress={isPolicyAdmin}
onSelectAll={filteredData.length > 0 ? () => toggleAllUsers(filteredData) : undefined}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FitseTLT Though I'm not sure, should we also use debounce data here instead of raw filteredData?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Copy Markdown
Contributor Author

@Uzaifm127 Uzaifm127 May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest bug (mentioned by you) is caused by this so we must do this.

Implemented.

@FitseTLT
Copy link
Copy Markdown
Contributor

FitseTLT commented May 1, 2026

@Uzaifm127 there is a new bug the spacing on the header disappears quickly before the header does. Look

2026-05-01.19-08-37.mp4

@Uzaifm127
Copy link
Copy Markdown
Contributor Author

@FitseTLT Coincidentally, that bug is caused this

@FitseTLT
Copy link
Copy Markdown
Contributor

FitseTLT commented May 1, 2026

Also don't you think we should reset selection on filter change see this:

2026-05-01.20-31-36.mp4

@Uzaifm127
Copy link
Copy Markdown
Contributor Author

@FitseTLT Do we also need to do with Search too? should we remove selection on search?

@FitseTLT
Copy link
Copy Markdown
Contributor

FitseTLT commented May 1, 2026

I think so

@Uzaifm127
Copy link
Copy Markdown
Contributor Author

Done for Filters and Search.

Copy link
Copy Markdown
Contributor

@FitseTLT FitseTLT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@melvin-bot melvin-bot Bot requested a review from srikarparsi May 1, 2026 18:30
@srikarparsi srikarparsi merged commit a4898c6 into Expensify:main May 4, 2026
39 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🚧 @srikarparsi has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify
Copy link
Copy Markdown
Contributor

OSBotify commented May 4, 2026

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Copy Markdown
Contributor

OSBotify commented May 4, 2026

🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.3.66-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 cancelled 🔪
🍎 iOS 🍎 cancelled 🔪

@MelvinBot
Copy link
Copy Markdown
Contributor

Yes, help site changes are required. PR #88293 adds a role-based member filter to the Workspace Members page, but the existing help article (Managing-Workspace-Members.md) doesn't document this feature.

I've created a draft PR with the docs update: #89492

Changes made:

  • Added a new "Filter Workspace Members by Role" section documenting the role filter dropdown and its options (All members, Admins, Approvers, Auditors)
  • Updated article metadata keywords to include filter-related terms

Note: I was unable to add the PR to GitHub project 196 due to token permission limitations. Please add it manually: gh project item-add 196 --owner Expensify --url https://github.com/Expensify/App/pull/89492

@Uzaifm127
Copy link
Copy Markdown
Contributor Author

@stephanieelliott As per this Slack thread, Melvin posted that the help site changes are required but I'm not able to mark the PR ready for review?

Could you please help me how can I proceed further? Do I need to ping in the comment after reviewing the PR?

Do I only need to run this command: gh project item-add 196 --owner Expensify --url https://github.com/Expensify/App/pull/89492 ?

@jponikarchuk
Copy link
Copy Markdown

Deploy Blocker #89554 was identified to be related to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants