Skip to content

[Due for payment 2026-06-24] [$250] [BA] Share option appears on business bank account when user has only joined another workspace as a member #93045

Closed

Description

@MelvinBot

Action Performed:

Prerequisite:

  • Own workspace(s) without other members
  • At least one workspace connected to a (verified business) bank account
  • Joined another user's workspace (as a member, not admin)
  1. Go to Account Settings > Wallet
  2. Press the three-dot icon on the business bank account

Expected Result:

There is no Share option, because the user has no other admin in their own workspace to share the bank account with.

Actual Result:

The Share option is available.

Root Cause

The Share menu item is gated by hasEligibleActiveAdmin, computed by hasEligibleActiveAdminFromWorkspaces, which calls getActivePolicies — this returns all policies the user belongs to, regardless of role (member or admin). So joining another user's workspace as a plain member makes the Share button appear.

The share page itself, however, builds its recipient list with getEligibleBankAccountShareRecipients → getActiveAdminWorkspaces, which only considers policies where the user is an admin. The visibility gate and the recipient list disagree about what "eligible" means.

Notes

  • Split out from Expensify/App#91834 per this discussion. That issue tracks the workspace-with-no-members scenario; this one tracks the distinct visibility-vs-recipient mismatch where the user has only joined another workspace as a member.
web.mp4

Platforms:

  • Web

Filed on behalf of bernhardoj (request: #91834 (comment)).

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. trasnake87 commented on Jun 9, 2026

    @trasnake87
    Contributor

    Proposal

    What is the root cause

    hasEligibleActiveAdminFromWorkspaces (src/libs/PolicyUtils.ts:352) uses getActivePolicies to build its policy list. getActivePolicies (line 87) returns every policy the user belongs to — regardless of their role — by checking only that getPolicyRole(policy, currentUserLogin) is truthy (any role counts). For each policy in that full list, the function then calls getAdminEmployees(policy), which returns other admins in that workspace. So if the user has joined another workspace as a plain member, that workspace's admins are found and the function returns true, causing the Share button to appear.

    The sister function getEligibleBankAccountShareRecipients (line 311) — which builds the actual recipient list on the Share screen — already uses getActiveAdminWorkspaces (line 1574), which filters to only policies where the current user holds an admin role. The visibility gate (hasEligibleActiveAdminFromWorkspaces) and the recipient builder (getEligibleBankAccountShareRecipients) are therefore inconsistent: the gate opens for any workspace membership while the recipient list requires admin ownership, so a member-only user sees the Share option but the screen renders an empty list.

    What changes should be made

    src/libs/PolicyUtils.ts — one-line fix in hasEligibleActiveAdminFromWorkspaces:

    // Before (line 354)
    const activePolicies = getActivePolicies(policies, currentUserLogin);
    
    // After
    const activePolicies = getActiveAdminWorkspaces(policies, currentUserLogin);

    This makes the visibility gate consistent with the recipient builder: the Share option only appears when the current user is an admin in at least one active workspace that has other admins available to share with.

    No changes are needed in WalletPage/index.tsx or anywhere else — the fix is entirely inside the utility that computes the boolean.

    Test — add a case to src/libs/__tests__/PolicyUtils.test.ts that sets up a user who is an admin in their own workspace and a plain member in a second workspace. The second workspace has other admins. Assert that hasEligibleActiveAdminFromWorkspaces returns false when the user's own workspace has no other eligible admins (all already in sharees), and that getEligibleBankAccountShareRecipients returns an empty array in the same scenario — confirming the two functions stay in sync.

    Alternatives considered

    Filter in the component — Compute getEligibleBankAccountShareRecipients in WalletPage and hide the button when the list is empty. This works but duplicates eligibility logic in the UI layer and runs a heavier computation (full admin map construction) just to gate a menu item. The root cause is a wrong policy-filter call in the utility; fixing it there is cheaper and keeps UI components thin.

    Keep getActivePolicies but add a role check inside the loop — Add isPolicyAdmin(policy, currentUserLogin) inside hasEligibleActiveAdminFromWorkspaces's loop. This is equivalent to calling getActiveAdminWorkspaces but reimplements the filter inline, duplicating logic that already exists. Using the existing helper is cleaner.

  2. bernhardoj commented on Jun 10, 2026

    @bernhardoj
    Contributor

    @MelvinBot implement your own solution from here

  3. MelvinBot commented on Jun 10, 2026

    @MelvinBot
    ContributorAuthor

    🤖 Draft PR created: #93159
    Please mark it as "Ready for review" when it is ready for review.

  4. added
    Reviewing
    Weekly
    and removed
    Daily
    on Jun 10, 2026
  5. changed the title [-][BA] Share option appears on business bank account when user has only joined another workspace as a member[/-] [+][$250] [BA] Share option appears on business bank account when user has only joined another workspace as a member[/+] on Jun 10, 2026
  6. melvin-bot commented on Jun 10, 2026

    @melvin-bot
  7. self-assigned this
    on Jun 15, 2026
  8. added
    Daily
    and removed
    Reviewing
    Weekly
    on Jun 17, 2026
  9. changed the title [-][$250] [BA] Share option appears on business bank account when user has only joined another workspace as a member[/-] [+][Due for payment 2026-06-24] [$250] [BA] Share option appears on business bank account when user has only joined another workspace as a member[/+] on Jun 17, 2026
  10. melvin-bot commented on Jun 17, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  11. melvin-bot commented on Jun 17, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.9-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-06-24. 🎊

    For reference, here are some details about the assignees on this issue:

    • @bernhardoj requires payment through NewDot Manual Requests
  12. melvin-bot commented on Jun 22, 2026

    @melvin-bot

    @bernhardoj Huh... This is 4 days overdue. Who can take care of this?

  13. added
    Awaiting Payment
    on Jun 23, 2026
  14. melvin-bot commented on Jun 23, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on Jun 23, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2064646894674004646/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. bernhardoj commented on Jun 24, 2026

    @bernhardoj
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: N/A
      Link to the comment on the Issue: N/A

    Not a regression, it's been like that since the first implementation.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/652856

    Regression Test Proposal

    Precondition:

    • Own workspace(s) without other members
    • At least one workspace connected to a (verified business) bank account
    • Joined another user's workspace (as a member, not admin)

    Test:

    1. Go to Account Settings > Wallet
    2. Press the three-dot icon on the business bank account
    3. Verify there is no Share option, because the user has no other admin in their own workspace to share the bank account with

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-6ffd-a50f-67c4-7d8062785764
  17. mallenexpensify commented on Jun 26, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @bernhardoj due $250 via NewDot

  18. flaviadefaria commented on Jun 30, 2026

    @flaviadefaria
    Contributor

    Approved: @bernhardoj due $250 via NewDot

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

Metadata

Metadata

Labels

Awaiting PaymentDaily

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions