Skip to content

[$250] Workspace - RBR displays after select secondary login account as Additional approver #79637

Closed

Description

@jponikarchuk

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


Version Number: v9.3.2-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #78350
Email or phone of affected tester (no customers): leungbratt6+140109@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Windows 10/Chrome
App Component: Workspace Settings

Action Performed:

Precondition: User B has a secondary login
User A creates a Workspace and adds the secondary login of user B as a member

  1. Open the NewDot app
  2. Navigate to the Workspace Settings -> Workflows
  3. Change the current approver to User B
  4. Enter any amount in the Report amount
  5. Click on the Additional approver
  6. Select the secondary login of user B
  7. Click on the Workspace tab

Expected Result:

No placeholder avatar account of secondary login in the Additional approver

Actual Result:

After select placeholder avatar account of secondary login, a RBR is displayed in the Workspace tab "402 either a submitsTo or forwardsTo value is not a member of the policy: leungbratt6+140109@gmail.com"

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022012183551003502125
  • Upwork Job ID: 2012183551003502125
  • Last Price Increase: 2026-02-13
  • Automatic offers:
    • situchan | Contributor | 110595768
Issue OwnerCurrent Issue Owner: @bfitzexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 15, 2026
  2. melvin-bot commented on Jan 15, 2026

    @melvin-bot

    Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. annaweber830 commented on Jan 15, 2026

    @annaweber830
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When configuring Workspace → Workflows → Approvals, selecting a secondary-login “placeholder avatar” account as the Additional approver triggers a red-brick-road error on the Workspace tab: 402 either a submitsTo or forwardsTo value is not a member of the policy.

    What is the root cause of that problem?

    The over-limit additional approver picker was building its selectable list from policy.employeeList and allowed “duplicate/secondary login” entries that don’t resolve to real personal details / accountIDs (i.e., they aren’t valid selectable members). Selecting one stores that secondary login into overLimitForwardsTo (and/or related workflow fields), and the backend rejects it because that login is not a valid policy member, resulting in the 402 error.

    What changes do you think we should make in order to solve the problem?

    • Update the Additional approver (over-limit) selection list to only show valid workspace members by filtering options through the existing “workspace members → accountIDs” mapping (i.e., only include entries that can be resolved to a real member accountID / personalDetails record). This prevents secondary-login placeholder rows from appearing at all.
    • Add a defensive check at selection time: if the chosen login is not a valid workspace member, do not persist it as overLimitForwardsTo (and optionally fall back to the mapped primary login when we can infer it).
    • Keep behavior consistent with the primary approver picker (which already avoids listing non-resolvable members), so both pickers enforce the same “only real members can be selected” rule.
    if (!accountID) {
                        return null;
                    }
    
    const policyMemberEmailsToAccountIDs = getMemberAccountIDsForWorkspace(employeeList);
            const selectedAccountID = Number(policyMemberEmailsToAccountIDs[selectedApprover.login] ?? '');
            if (!selectedAccountID) {
                return;
            }
    

    What alternative solutions did you explore? (Optional)

    Add the same accountID guard to WorkspaceWorkflowsApprovalsOverLimitApproverPage so we never render/select options that aren’t recognized as real workspace members.

    const policyMemberEmailsToAccountIDs = getMemberAccountIDsForWorkspace(employeeList);
    return Object.values(employeeList)
    .map((employee): SelectionListApprover | null => {
    const email = employee.email;
    if (!email) {
    return null;
    }
    if (!isDefault && policy?.preventSelfApproval && membersEmail?.includes(email)) {
    return null;
    }
    if (email === currentApproverEmail) {
    return null;
    }
    const accountID = Number(policyMemberEmailsToAccountIDs[email] ?? '');
    const {avatar, displayName = email, login} = personalDetails?.[accountID] ?? {};
    return {
    text: displayName,
    alternateText: email,
    keyForList: email,
    isSelected: currentApprover?.overLimitForwardsTo === email,
    login: email,
    icons: [{source: avatar ?? expensifyIcons.FallbackAvatar, type: CONST.ICON_TYPE_AVATAR, name: displayName, id: accountID}],
    rightElement: (
    <MemberRightIcon
    role={employee.role}
    owner={policy?.owner}
    login={login}
    />
    ),
    };
    })
    .filter((approver): approver is SelectionListApprover => !!approver);

    Current code:

    return Object.values(employeeList)
        .map((employee): SelectionListApprover | null => {
            const email = employee.email;
    
            if (!email) {
                return null;
            }
    
            if (!isDefault && policy?.preventSelfApproval && membersEmail?.includes(email)) {
                return null;
            }
    
            if (email === currentApproverEmail) {
                return null;
            }
    
            const accountID = Number(policyMemberEmailsToAccountIDs[email] ?? '');
            const {avatar, displayName = email, login} = personalDetails?.[accountID] ?? {};
    
            return {
                text: displayName,
                alternateText: email,
                keyForList: email,
                isSelected: currentApprover?.overLimitForwardsTo === email,
                login: email,
                icons: [{source: avatar ?? expensifyIcons.FallbackAvatar, type: CONST.ICON_TYPE_AVATAR, name: displayName, id: accountID}],
                rightElement: (
                    <MemberRightIcon
                        role={employee.role}
                        owner={policy?.owner}
                        login={login}
                    />
                ),
            };
        })
        .filter((approver): approver is SelectionListApprover => !!approver);

    Updated code:

    return Object.values(employeeList)
        .map((employee): SelectionListApprover | null => {
            const email = employee.email;
    
            if (!email) {
                return null;
            }
    
            if (!isDefault && policy?.preventSelfApproval && membersEmail?.includes(email)) {
                return null;
            }
    
            if (email === currentApproverEmail) {
                return null;
            }
    
            const accountID = Number(policyMemberEmailsToAccountIDs[email] ?? '');
            if (!accountID) {
                return null;
            }
    
            const {avatar, displayName = email, login} = personalDetails?.[accountID] ?? {};
    
            return {
                text: displayName,
                alternateText: email,
                keyForList: email,
                isSelected: currentApprover?.overLimitForwardsTo === email,
                login: email,
                icons: [{source: avatar ?? expensifyIcons.FallbackAvatar, type: CONST.ICON_TYPE_AVATAR, name: displayName, id: accountID}],
                rightElement: (
                    <MemberRightIcon
                        role={employee.role}
                        owner={policy?.owner}
                        login={login}
                    />
                ),
            };
        })
        .filter((approver): approver is SelectionListApprover => !!approver);
  4. paulnjs commented on Jan 15, 2026

    @paulnjs
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    • RBR displays after select secondary login account as Additional approver

    What is the root cause of that problem?

    • When a secondary login account is invited to a workspace, both the primary and secondary emails end up in the policy.employeeList.
    • On the workspace member page, we already filter out secondary emails by checking for the absence of personal detail data, which is typical for secondary logins.
    • However, in
      return Object.values(employeeList)
      .map((employee): SelectionListApprover | null => {
      , this filtering logic is missing, so secondary emails are still shown.
    • The same issue also occurs in other workspace participant selectors.

    What changes do you think we should make in order to solve the problem?

    • Since this bug appears on multiple pages, we should extract the filtering logic into a shared utility hook.

    Here's the proposed hook:

    
    import {useMemo} from 'react';
    import {getMemberAccountIDsForWorkspace} from '@libs/PolicyUtils';
    import type {Policy, PolicyEmployeeList} from '@src/types/onyx';
    
    function usePolicyMember(policy: Policy | null | undefined): PolicyEmployeeList {
        return useMemo(() => {
            const employeeList = policy?.employeeList;
            if (!employeeList) {
                return {};
            }
    
            const memberAccountIDs = getMemberAccountIDsForWorkspace(employeeList);
    
            return Object.fromEntries(
                Object.entries(employeeList).filter(([email]) => Boolean(memberAccountIDs[email]))
            ) as PolicyEmployeeList;
        }, [policy?.employeeList]);
    }
    
    export default usePolicyMember;
    
    
    const employeeList = usePolicyMember(policy);
    

    What alternative solutions did you explore? (Optional)

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 16, 2026
  6. melvin-bot commented on Jan 16, 2026

    @melvin-bot
  7. changed the title [-]Workspace - RBR displays after select secondary login account as Additional approver[/-] [+][$250] Workspace - RBR displays after select secondary login account as Additional approver[/+] on Jan 16, 2026
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 16, 2026
  9. moved this to Bugs and Follow Up Issues in #expensify-bugson Jan 16, 2026
  10. melvin-bot commented on Jan 16, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

  11. KocaPepsi commented on Jan 19, 2026

    @KocaPepsi
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    RBR displays after select secondary login account as Additional approver.

    What is the root cause of that problem?

    1. Secondary emails in employee list: When a user's secondary login email is added to a workspace, it appears in policy.employeeList with the secondary email as the key.

    2. Missing validation in some pages: Some pages iterate through employeeList directly without checking if the email resolves to a valid accountID via personalDetails. Secondary login emails don't have corresponding personalDetails entries.

    3. Inconsistent filtering pattern:

    What changes do you think we should make in order to solve the problem?

    Add the missing validation check to filter out secondary login emails that don't have valid accountIDs.

    const accountID = Number(policyMemberEmailsToAccountIDs[email] ?? '');

    update to:

    const accountID = Number(policyMemberEmailsToAccountIDs[email] ?? '');
    
    // Filter out secondary login emails that don't have valid accountIDs
    if (!accountID) {
        return null;
    }
    
    const {avatar, displayName = email, login} = personalDetails?.[accountID] ?? {};

    const personalDetail = getPersonalDetailByEmail(email);

    update to:

    const personalDetail = getPersonalDetailByEmail(email);
    
    // Filter out secondary login emails that don't have valid personal details
    if (!personalDetail?.accountID) {
        continue;
    }
    
    membersList.push({...});

    const personalDetail = getPersonalDetailByEmail(email);

    update to:

    const personalDetail = getPersonalDetailByEmail(email);
    
    // Filter out secondary login emails that don't have valid personal details
    if (!personalDetail?.accountID) {
        continue;
    }
    
    membersList.push({...});

    What alternative solutions did you explore?

    N/A

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  12. 52 remaining items

  13. melvin-bot commented on Mar 27, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @lakchote, @bfitzexpensify, @situchan, @annaweber830 eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  14. situchan commented on Mar 30, 2026

    @situchan
    Contributor

    Automation failed here. PR deployed to production on Mar 6.

    @bfitzexpensify can you please sort payment? Thanks

  15. annaweber830 commented on Apr 16, 2026

    @annaweber830
    Contributor

    @lakchote, @bfitzexpensify PR deployed to production on Mar 6.

  16. annaweber830 commented on Apr 20, 2026

    @annaweber830
    Contributor

    @lakchote, @bfitzexpensify, @situchan PR deployed to production on Mar 6.

  17. bfitzexpensify commented on Apr 21, 2026

    @bfitzexpensify
    Contributor

    Payment summary:

    @situchan due $250 via NewDot manual request

    Dm'd @annaweber830 for Upwork link

  18. bfitzexpensify commented on Apr 23, 2026

    @bfitzexpensify
    Contributor

    Payments complete

  19. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Apr 23, 2026
  20. laurenreidexpensify commented on Apr 27, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @situchan

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions