Skip to content

Add Card Admin workspace access#92740

Merged
flodnv merged 36 commits into
Expensify:mainfrom
ShridharGoel:ws1.4-upstream-main
Jun 12, 2026
Merged

Add Card Admin workspace access#92740
flodnv merged 36 commits into
Expensify:mainfrom
ShridharGoel:ws1.4-upstream-main

Conversation

@ShridharGoel

@ShridharGoel ShridharGoel commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

This adds frontend support for the Card Admin scoped workspace role.

Card Admins can access Overview, Members, Expensify Card, and Company Cards. Expensify Card and Company Cards use write-level feature checks so Card Admins can manage cards in those areas, while other workspace settings remain blocked.

This also adds Card Admin labels in member role surfaces, updates role display copy for workspace change logs, and updates imported-member role handling.

Fixed Issues

$ #90499, #90500, #90501
PROPOSAL:

Tests

  1. Sign in as a Workspace Admin on a control policy.
  2. Go to Workspace settings > Members.
  3. Change a member role to Card Admin.
  4. Sign in as that Card Admin.
  5. Verify Overview, Members, Expensify Card, and Company Cards are visible in the workspace LHN.
  6. Verify other workspace settings pages are hidden or blocked.
  7. Open Expensify Card and verify card issue, card details, card settings, and card spend rule pages are accessible where setup is complete.
  8. Open Company Cards and verify card details, assign card, import card feed, card settings, and related card management pages are accessible.
  9. Verify Card Admin cannot start Expensify Card bank-account setup and sees the "Not so fast" modal when setup is required.
  10. Verify Workspace Admin still has normal access to workspace settings and card setup flows.
  11. Verify that no errors appear in the JS console.
  • Verify that no errors appear in the JS console

Offline tests

  1. Repeat the Card Admin navigation checks while offline.
  2. Verify already-loaded card pages remain readable.
  3. Verify write actions that require network do not complete while offline.

QA Steps

Same as tests.

  • 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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-06-05.at.11.48.50.AM.mov

@melvin-bot

melvin-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Coverage Δ
src/CONST/index.ts 93.84% <ø> (ø)
...onents/Tables/WorkspaceCompanyCardsTable/index.tsx 0.00% <ø> (ø)
src/hooks/useIsAllowedToIssueCompanyCard.ts 100.00% <100.00%> (ø)
src/libs/PolicyUtils.ts 74.19% <ø> (+1.50%) ⬆️
src/libs/ReportActionsUtils.ts 77.58% <100.00%> (ø)
src/libs/actions/Policy/Member.ts 75.99% <100.00%> (+0.36%) ⬆️
src/pages/workspace/AccessOrNotFoundWrapper.tsx 80.00% <100.00%> (+0.58%) ⬆️
...ace/companyCards/RefreshCardFeedConnectionPage.tsx 100.00% <100.00%> (ø)
...panyCards/WorkspaceCompanyCardAddWorkEmailPage.tsx 0.00% <ø> (ø)
...panyCards/WorkspaceCompanyCardEditCardNamePage.tsx 0.00% <ø> (ø)
... and 52 more
... and 148 files with indirect coverage changes

@ShridharGoel

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 3570a29fa7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@OSBotify

This comment has been minimized.

@ShridharGoel ShridharGoel marked this pull request as ready for review June 5, 2026 06:20
@ShridharGoel ShridharGoel requested review from a team as code owners June 5, 2026 06:20
@melvin-bot melvin-bot Bot requested review from Pujan92 and trjExpensify and removed request for a team June 5, 2026 06:20
@melvin-bot

melvin-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

@Pujan92 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 the request for review from a team June 5, 2026 06:20

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

Copy link
Copy Markdown

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: 9a172d17cd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

trjExpensify
trjExpensify previously approved these changes Jun 5, 2026

@trjExpensify trjExpensify left a comment

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.

Core PR for a WN project. 👍

@flodnv flodnv merged commit aaed321 into Expensify:main Jun 12, 2026
35 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

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

@lanitochka17

Copy link
Copy Markdown

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Card admin can click Learn more on Get the Expensify Card banner which enables Expensify Card

Version Number: 9.4.6-0 PR:92740
Reproducible in staging?: N
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • User A invites User B to workspace as card admin.
  • Perform steps below as card admin (User B).
  1. Go to https://92740.pr-testing.expensify.com/
  2. Go to workspace settings > Company cards
  3. Click Learn more on Get the Expensify Card banner
  4. Go to Workspaces main page
  5. Open the workspace

Expected Result:

Card admin should not be allowed to click Learn more on Get the Expensify Card banner because it will enable Expensify Card

Actual Result:

Card admin can click Learn more on Get the Expensify Card banner. Expensify Card tab appears and disappears after navigating away

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug7179101_1781282585925.1.mp4
Upwork Automation - Do Not Edit

    @lanitochka17

    Copy link
    Copy Markdown

    If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


    Expensify Card - Error after renaming card, changing limit and limit type as card admin

    Version Number: 9.4.6-0 PR:92740
    Reproducible in staging?: N
    Reproducible in production?: N
    If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
    Issue reported by: Applause - Internal Team

    Action Performed:

    Precondition:

    • User A invites User B to workspace as card admin.
    • Workspace has at least one virtual card.
    • Perform steps below as card admin (User B).
    1. Go to https://92740.pr-testing.expensify.com/
    2. Go to workspace settings > Expensify Card
    3. Open any card
    4. Click Name
    5. Edit name and save it

    Expected Result:

    Name will be saved without issue

    Actual Result:

    Error shows up after editing card name as card admin
    This issue also applies to changing card limit and limit type

    Workaround:

    Unknown

    Platforms:

    Which of our officially supported platforms is this issue occurring on?

    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop

    Screenshots/Videos

    Bug7179115_1781283536099.2.mp4
    Upwork Automation - Do Not Edit

      @lanitochka17

      Copy link
      Copy Markdown

      If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


      Expensify Card - Edit spend rule opens not here page for card admin when Rules are disabled

      Version Number: 9.4.6-0 PR:92740
      Reproducible in staging?: N
      Reproducible in production?: N
      If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
      Issue reported by: Applause - Internal Team

      Action Performed:

      Precondition:

      • User A invites User B to workspace as card admin.
      • Workspace has at least one virtual card.
      • Do not enable Rules.
      • Perform steps below as card admin (User B).
      1. Go to https://92740.pr-testing.expensify.com/
      2. Go to workspace settings > Expensify Card
      3. Open any card
      4. Click Edit spend rules

      Expected Result:

      Edit spend rules should be disabled for card admin when Rules are disabled

      Actual Result:

      Edit spend rules is not disabled for card admin when Rules are disabled
      Card admin can click on it which opens not here page

      Workaround:

      Unknown

      Platforms:

      Which of our officially supported platforms is this issue occurring on?

      • Android: Native
      • Android: mWeb Chrome
      • iOS: Native
      • iOS: mWeb Safari
      • MacOS: Chrome / Safari
      • MacOS: Desktop

      Screenshots/Videos

      Bug7179132_1781284433513.3.mp4
      Upwork Automation - Do Not Edit

        @lanitochka17

        Copy link
        Copy Markdown

        If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


        Not here page opens when card admin invites user to workspace when issuing card

        Version Number: 9.4.6-0 PR:92740
        Reproducible in staging?: N
        Reproducible in production?: N
        If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
        Issue reported by: Applause - Internal Team

        Action Performed:

        Precondition:

        • User A invites User B to workspace as card admin.
        • Workspace has business bank account and set up with Expensify Card.
        • Perform steps below as card admin (User B).
        1. Go to https://92740.pr-testing.expensify.com/
        2. Go to workspace settings > Expensify Card
        3. Click Issue card
        4. Enter email of non-member
        5. Select the user

        Expected Result:

        Card admin should be shown a better message that they cannot invite member to the workspace when issuing card

        Actual Result:

        Not here page opens when card admin invites user to workspace when issuing card

        Workaround:

        Unknown

        Platforms:

        Which of our officially supported platforms is this issue occurring on?

        • Android: Native
        • Android: mWeb Chrome
        • iOS: Native
        • iOS: mWeb Safari
        • MacOS: Chrome / Safari
        • MacOS: Desktop

        Screenshots/Videos

        Bug7179154_1781285779553.4.mp4
        Upwork Automation - Do Not Edit

          @lanitochka17

          Copy link
          Copy Markdown

          If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


          Company cards - Add card RHP loads infinitely after card admin finishes Plaid flow

          Version Number: 9.4.6-0 PR:92740
          Reproducible in staging?: N
          Reproducible in production?: N
          If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
          Issue reported by: Applause - Internal Team

          Action Performed:

          Precondition:

          • User A invites User B to workspace as card admin.
          • Perform steps below as card admin (User B).
          1. Go to https://92740.pr-testing.expensify.com/
          2. Go to workspace settings > Company cards.
          3. Click Add card > Add card.
          4. Select United States > Next.
          5. Select Direct feed > Other > Next.
          6. Complete Plaid flow.

          Expected Result:

          Direct feed will be added successfully by card admin

          Actual Result:

          dd card RHP loads infinitely after card admin finishes Plaid flow

          Workaround:

          Unknown

          Platforms:

          Which of our officially supported platforms is this issue occurring on?

          • Android: Native
          • Android: mWeb Chrome
          • iOS: Native
          • iOS: mWeb Safari
          • MacOS: Chrome / Safari
          • MacOS: Desktop

          Screenshots/Videos

          Bug7179162_1781286199144.5.mp4
          Upwork Automation - Do Not Edit

            @OSBotify

            Copy link
            Copy Markdown
            Contributor

            🚀 Deployed to staging by https://github.com/flodnv in version: 9.4.7-0 🚀

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

            Bundle Size Analysis (Sentry):

            @MelvinBot

            Copy link
            Copy Markdown
            Contributor

            Help site changes required ✅

            This PR adds a user-facing Card Admin workspace role and renames AdminWorkspace Admin in the member role surfaces, so the help site needs updating.

            The affected article is Managing-Workspace-Members.md, which documents the workspace roles list and the member role filter — both of which referenced the old Admin label and were missing the new Card Admin role.

            Draft PR: #93481

            Changes made there:

            • Added the Card Admin role to the roles list (manages workspace cards — Expensify Card and Company Cards — but cannot change other workspace settings; Control-only).
            • Renamed AdminWorkspace Admin in the roles list, role filter, and transfer-ownership step to match the live UI copy.
            • Added the Card Admins filter option and noted Control-plan availability for Auditor and Card Admin.

            Labels match src/languages/en.ts (roleNameWorkspace Admin, filter labels Workspace Admins / Card Admins).

            @ShridharGoel, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review.

            @ShridharGoel

            ShridharGoel commented Jun 12, 2026

            Copy link
            Copy Markdown
            Contributor Author

            @Expensify/design Is this fine for issue 4 (card admins can't select any user who is not a part of the workspace) ?

            Screenshot 2026-06-13 at 2 18 38 PM

            @nlemma

            nlemma commented Jun 12, 2026

            Copy link
            Copy Markdown

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

            @mitarachim

            Copy link
            Copy Markdown

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

            @mitarachim

            Copy link
            Copy Markdown

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

            @mitarachim

            Copy link
            Copy Markdown

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

            @mitarachim

            Copy link
            Copy Markdown

            Deploy Blocker #93509 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