You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[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
At least one workspace connected to a (verified business) bank account
Joined another user's workspace (as a member, not admin)
Go to Account Settings > Wallet
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.
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)constactivePolicies=getActivePolicies(policies,currentUserLogin);// AfterconstactivePolicies=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.
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
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
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:
[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.
Activity
trasnake87 commentedon Jun 9, 2026
Proposal
What is the root cause
hasEligibleActiveAdminFromWorkspaces(src/libs/PolicyUtils.ts:352) usesgetActivePoliciesto build its policy list.getActivePolicies(line 87) returns every policy the user belongs to — regardless of their role — by checking only thatgetPolicyRole(policy, currentUserLogin)is truthy (any role counts). For each policy in that full list, the function then callsgetAdminEmployees(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 returnstrue, causing the Share button to appear.The sister function
getEligibleBankAccountShareRecipients(line 311) — which builds the actual recipient list on the Share screen — already usesgetActiveAdminWorkspaces(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 inhasEligibleActiveAdminFromWorkspaces: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.tsxor anywhere else — the fix is entirely inside the utility that computes the boolean.Test — add a case to
src/libs/__tests__/PolicyUtils.test.tsthat 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 thathasEligibleActiveAdminFromWorkspacesreturnsfalsewhen the user's own workspace has no other eligible admins (all already insharees), and thatgetEligibleBankAccountShareRecipientsreturns an empty array in the same scenario — confirming the two functions stay in sync.Alternatives considered
Filter in the component — Compute
getEligibleBankAccountShareRecipientsinWalletPageand 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
getActivePoliciesbut add a role check inside the loop — AddisPolicyAdmin(policy, currentUserLogin)insidehasEligibleActiveAdminFromWorkspaces's loop. This is equivalent to callinggetActiveAdminWorkspacesbut reimplements the filter inline, duplicating logic that already exists. Using the existing helper is cleaner.bernhardoj commentedon Jun 10, 2026
@MelvinBot implement your own solution from here
MelvinBot commentedon Jun 10, 2026
🤖 Draft PR created: #93159
Please mark it as "Ready for review" when it is ready for review.
[-][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[/+]melvin-bot commentedon Jun 10, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022064646894674004646
[-][$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[/+]melvin-bot commentedon Jun 17, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jun 17, 2026
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:
melvin-bot commentedon Jun 22, 2026
@bernhardoj Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Jun 23, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 23, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
bernhardoj commentedon Jun 24, 2026
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:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-6ffd-a50f-67c4-7d8062785764mallenexpensify commentedon Jun 26, 2026
Payment Summary
Contributor+: @bernhardoj due $250 via NewDot
flaviadefaria commentedon Jun 30, 2026
Approved: @bernhardoj due $250 via NewDot