Skip to content

[Due for payment 2026-03-03][$250] Long tap on the app icon shows the participant selector even though my workspace is domain controlled #76179

Closed

Description

@heyjennahay

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:
Reproducible in staging?:
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers): jenna@expensify.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @heyjennahay
Slack conversation (hyperlinked to channel name): #quality

Action Performed:

  1. As an Admin, go to Domains > [domain] > Domain Members
  2. Search for the submitter and see what Domain Group they are a member of
  3. Go to Groups and set a Preferred workspace for the group and Save
  4. As the submitter, on mobile, long tap the Expensify app icon and select SmartScan
  5. Tap the green button to take a photo

Expected Result:

I should go directly to the expense details page as my workspace is domain controlled thus locked

Actual Result:

I am taken to the the participant selector page

Workaround:

N/A

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App - Pixel 6
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021993805518764612013
  • Upwork Job ID: 1993805518764612013
  • Last Price Increase: 2025-11-26
Issue OwnerCurrent Issue Owner: @lydiabarclay

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 26, 2025
  2. melvin-bot commented on Nov 26, 2025

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (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. samranahm commented on Nov 26, 2025

    @samranahm
    Contributor

    Proposal

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

    Long tap on the app icon shows the participant selector even though my workspace is domain controlled

    What is the root cause of that problem?

    When a user with a domain-controlled workspace use the long-tap app icon to access SmartScan, the appis not checking if they are restricted to a preferred policy. It would always show the participant selector, requiring users to manually select the workspace again.

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

    We should add logic to both the native and web versions of IOURequestStepScan to detect when a user is restricted to a preferred policy and automatically skip the participant selection step, going directly to the confirmation page with the preferred workspace pre-assigned.

    const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy();
    .
    .
    
    } else if (isRestrictedToPreferredPolicy && preferredPolicyID) {
    const selectedPolicy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${preferredPolicyID}`];
    if (selectedPolicy) {
        const policyExpenseChat = getPolicyExpenseChat(currentUserPersonalDetails.accountID, preferredPolicyID);
        if (policyExpenseChat) {
            const setParticipantsPromises = files.map((receiptFile) => setMoneyRequestParticipantsFromReport(receiptFile.transactionID, policyExpenseChat));
            Promise.all(setParticipantsPromises).then(() =>
                Navigation.navigate(
                    ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(
                        CONST.IOU.ACTION.CREATE,
                        iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
                        initialTransactionID,
                        policyExpenseChat?.reportID,
                    ),
                ),
            );
            return;
        }
    }
    navigateToParticipantPage(iouType, initialTransactionID, reportID);

    here

    } else {
    navigateToParticipantPage(iouType, initialTransactionID, reportID);
    }

    What alternative solutions did you explore? (Optional)

    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.

  4. lydiabarclay commented on Nov 26, 2025

    @lydiabarclay
    Contributor

    Confirmed: When you have a policy forced in domain control, you should not see the option to select another workspace when scanning

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 26, 2025
  6. changed the title [-]Long tap on the app icon shows the participant selector even though my workspace is domain controlled[/-] [+][$250] Long tap on the app icon shows the participant selector even though my workspace is domain controlled[/+] on Nov 26, 2025
  7. melvin-bot commented on Nov 26, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 26, 2025
  9. melvin-bot commented on Nov 26, 2025

    @melvin-bot

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

  10. lorretheboy commented on Nov 27, 2025

    @lorretheboy
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-11-27 00:20:20 UTC.

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

    Not duplicated: The condition in 2 proposals are different and also my proposal handles in 2 places

    Proposal

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

    Long tap on the app icon shows the participant selector even though my workspace is domain controlled

    What is the root cause of that problem?

    The navigateToConfirmationStep function in both the mobile and web versions of IOURequestStepScan only checked for a default expense policy (via useDefaultExpensePolicy hook) when determining whether to skip the participant selector.

    const navigateToConfirmationStep = useCallback(
    (files: ReceiptFile[], locationPermissionGranted = false, isTestTransaction = false) => {
    if (backTo) {
    Navigation.goBack(backTo);
    return;
    }
    if (isTestTransaction) {
    const managerMcTestParticipant = getManagerMcTestParticipant() ?? {};
    let reportIDParam = managerMcTestParticipant.reportID;
    if (!managerMcTestParticipant.reportID && report?.reportID) {
    reportIDParam = generateReportID();
    }
    setMoneyRequestParticipants(
    initialTransactionID,
    [
    {
    ...managerMcTestParticipant,
    reportID: reportIDParam,
    selected: true,
    },
    ],
    true,
    ).then(() => {
    navigateToConfirmationPage(true, reportIDParam);
    });
    return;
    }
    // If the user started this flow from using the + button in the composer inside a report
    // the participants can be automatically assigned from the report and the user can skip the participants step and go straight
    // to the confirmation step.
    // If the user is started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
    if (!initialTransaction?.isFromGlobalCreate && !isArchivedReport(reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {
    const selectedParticipants = getMoneyRequestParticipantsFromReport(report);
    const participants = selectedParticipants.map((participant) => {
    const participantAccountID = participant?.accountID ?? CONST.DEFAULT_NUMBER_ID;
    return participantAccountID ? getParticipantsOption(participant, personalDetails) : getReportOption(participant, reportAttributesDerived);
    });
    if (shouldSkipConfirmation) {
    const firstReceiptFile = files.at(0);
    if (iouType === CONST.IOU.TYPE.SPLIT && firstReceiptFile) {
    const splitReceipt: Receipt = firstReceiptFile.file ?? {};
    splitReceipt.source = firstReceiptFile.source;
    splitReceipt.state = CONST.IOU.RECEIPT_STATE.SCAN_READY;
    startSplitBill({
    participants,
    currentUserLogin: currentUserPersonalDetails?.login ?? '',
    currentUserAccountID: currentUserPersonalDetails.accountID,
    comment: '',
    receipt: splitReceipt,
    existingSplitChatReportID: reportID,
    billable: false,
    category: '',
    tag: '',
    currency: initialTransaction?.currency ?? 'USD',
    taxCode: transactionTaxCode,
    taxAmount: transactionTaxAmount,
    });
    return;
    }
    const participant = participants.at(0);
    if (!participant) {
    return;
    }
    if (locationPermissionGranted) {
    getCurrentPosition(
    (successData) => {
    const policyParams = {policy};
    const gpsPoint = {
    lat: successData.coords.latitude,
    long: successData.coords.longitude,
    };
    createTransaction(files, participant, gpsPoint, policyParams, false);
    },
    (errorData) => {
    Log.info('[IOURequestStepScan] getCurrentPosition failed', false, errorData);
    // When there is an error, the money can still be requested, it just won't include the GPS coordinates
    createTransaction(files, participant);
    },
    {
    maximumAge: CONST.GPS.MAX_AGE,
    timeout: CONST.GPS.TIMEOUT,
    },
    );
    return;
    }
    createTransaction(files, participant);
    return;
    }
    const setParticipantsPromises = files.map((receiptFile) => setMoneyRequestParticipantsFromReport(receiptFile.transactionID, report));
    Promise.all(setParticipantsPromises).then(() => navigateToConfirmationPage());
    return;
    }
    // If there was no reportID, then that means the user started this flow from the global + menu
    // and an optimistic reportID was generated. In that case, the next step is to select the participants for this expense.
    if (
    iouType === CONST.IOU.TYPE.CREATE &&
    isPaidGroupPolicy(defaultExpensePolicy) &&
    defaultExpensePolicy?.isPolicyExpenseChatEnabled &&
    !shouldRestrictUserBillableActions(defaultExpensePolicy.id)
    ) {
    const activePolicyExpenseChat = getPolicyExpenseChat(currentUserPersonalDetails.accountID, defaultExpensePolicy?.id);
    const shouldAutoReport = !!defaultExpensePolicy?.autoReporting || !!personalPolicy?.autoReporting;
    const transactionReportID = shouldAutoReport ? activePolicyExpenseChat?.reportID : CONST.REPORT.UNREPORTED_REPORT_ID;
    // If the initial transaction has different participants selected that means that the user has changed the participant in the confirmation step
    if (initialTransaction?.participants && initialTransaction?.participants?.at(0)?.reportID !== activePolicyExpenseChat?.reportID) {
    const isTrackExpense = initialTransaction?.participants?.at(0)?.reportID === selfDMReportID;
    const setParticipantsPromises = files.map((receiptFile) => setMoneyRequestParticipants(receiptFile.transactionID, initialTransaction?.participants));
    Promise.all(setParticipantsPromises).then(() => {
    if (isTrackExpense) {
    Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(CONST.IOU.ACTION.CREATE, CONST.IOU.TYPE.TRACK, initialTransactionID, selfDMReportID));
    } else {
    navigateToConfirmationPage(iouType === CONST.IOU.TYPE.CREATE, initialTransaction?.reportID);
    }
    });
    return;
    }
    const setParticipantsPromises = files.map((receiptFile) => {
    setTransactionReport(receiptFile.transactionID, {reportID: transactionReportID}, true);
    return setMoneyRequestParticipantsFromReport(receiptFile.transactionID, activePolicyExpenseChat);
    });
    Promise.all(setParticipantsPromises).then(() =>
    Navigation.navigate(
    ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(
    CONST.IOU.ACTION.CREATE,
    iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
    initialTransactionID,
    activePolicyExpenseChat?.reportID,
    ),
    ),
    );
    } else {
    navigateToParticipantPage(iouType, initialTransactionID, reportID);
    }
    },

    const navigateToConfirmationStep = useCallback(
    (files: ReceiptFile[], locationPermissionGranted = false, isTestTransaction = false) => {
    if (backTo) {
    Navigation.goBack(backTo);
    return;
    }
    if (isTestTransaction) {
    const managerMcTestParticipant = getManagerMcTestParticipant() ?? {};
    let reportIDParam = managerMcTestParticipant.reportID;
    if (!managerMcTestParticipant.reportID && report?.reportID) {
    reportIDParam = generateReportID();
    }
    setMoneyRequestParticipants(
    initialTransactionID,
    [
    {
    ...managerMcTestParticipant,
    reportID: reportIDParam,
    selected: true,
    },
    ],
    true,
    ).then(() => {
    navigateToConfirmationPage(true, reportIDParam);
    });
    return;
    }
    // If the user started this flow from using the + button in the composer inside a report
    // the participants can be automatically assigned from the report and the user can skip the participants step and go straight
    // to the confirmation step.
    // If the user is started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
    if (!initialTransaction?.isFromGlobalCreate && !isArchivedReport(reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {
    const selectedParticipants = getMoneyRequestParticipantsFromReport(report);
    const participants = selectedParticipants.map((participant) => {
    const participantAccountID = participant?.accountID ?? CONST.DEFAULT_NUMBER_ID;
    return participantAccountID ? getParticipantsOption(participant, personalDetails) : getReportOption(participant, reportAttributesDerived);
    });
    if (shouldSkipConfirmation) {
    const firstReceiptFile = files.at(0);
    if (iouType === CONST.IOU.TYPE.SPLIT && firstReceiptFile) {
    const splitReceipt: Receipt = firstReceiptFile.file ?? {};
    splitReceipt.source = firstReceiptFile.source;
    splitReceipt.state = CONST.IOU.RECEIPT_STATE.SCAN_READY;
    startSplitBill({
    participants,
    currentUserLogin: currentUserPersonalDetails?.login ?? '',
    currentUserAccountID: currentUserPersonalDetails.accountID,
    comment: '',
    receipt: splitReceipt,
    existingSplitChatReportID: reportID,
    billable: false,
    category: '',
    tag: '',
    currency: initialTransaction?.currency ?? 'USD',
    taxCode: transactionTaxCode,
    taxAmount: transactionTaxAmount,
    });
    return;
    }
    const participant = participants.at(0);
    if (!participant) {
    return;
    }
    if (locationPermissionGranted) {
    getCurrentPosition(
    (successData) => {
    const policyParams = {policy};
    const gpsPoint = {
    lat: successData.coords.latitude,
    long: successData.coords.longitude,
    };
    createTransaction(files, participant, gpsPoint, policyParams, false, true);
    },
    (errorData) => {
    Log.info('[IOURequestStepScan] getCurrentPosition failed', false, errorData);
    // When there is an error, the money can still be requested, it just won't include the GPS coordinates
    createTransaction(files, participant);
    },
    {
    maximumAge: CONST.GPS.MAX_AGE,
    timeout: CONST.GPS.TIMEOUT,
    },
    );
    return;
    }
    createTransaction(files, participant);
    return;
    }
    const transactionIDs = files.map((receiptFile) => receiptFile.transactionID);
    setMultipleMoneyRequestParticipantsFromReport(transactionIDs, report).then(() => navigateToConfirmationPage());
    return;
    }
    // If there was no reportID, then that means the user started this flow from the global + menu
    // and an optimistic reportID was generated. In that case, the next step is to select the participants for this expense.
    if (
    iouType === CONST.IOU.TYPE.CREATE &&
    isPaidGroupPolicy(defaultExpensePolicy) &&
    defaultExpensePolicy?.isPolicyExpenseChatEnabled &&
    !shouldRestrictUserBillableActions(defaultExpensePolicy.id)
    ) {
    const activePolicyExpenseChat = getPolicyExpenseChat(currentUserPersonalDetails.accountID, defaultExpensePolicy?.id);
    const shouldAutoReport = !!defaultExpensePolicy?.autoReporting || !!personalPolicy?.autoReporting;
    const transactionReportID = shouldAutoReport ? activePolicyExpenseChat?.reportID : CONST.REPORT.UNREPORTED_REPORT_ID;
    // If the initial transaction has different participants selected that means that the user has changed the participant in the confirmation step
    if (initialTransaction?.participants && initialTransaction?.participants?.at(0)?.reportID !== activePolicyExpenseChat?.reportID) {
    const isTrackExpense = initialTransaction?.participants?.at(0)?.reportID === selfDMReportID;
    const setParticipantsPromises = files.map((receiptFile) => setMoneyRequestParticipants(receiptFile.transactionID, initialTransaction?.participants));
    Promise.all(setParticipantsPromises).then(() => {
    if (isTrackExpense) {
    Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(CONST.IOU.ACTION.CREATE, CONST.IOU.TYPE.TRACK, initialTransactionID, selfDMReportID));
    } else {
    navigateToConfirmationPage(iouType === CONST.IOU.TYPE.CREATE, initialTransaction?.reportID);
    }
    });
    return;
    }
    const setParticipantsPromises = files.map((receiptFile) => {
    setTransactionReport(receiptFile.transactionID, {reportID: transactionReportID}, true);
    return setMoneyRequestParticipantsFromReport(receiptFile.transactionID, activePolicyExpenseChat);
    });
    Promise.all(setParticipantsPromises).then(() =>
    Navigation.navigate(
    ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(
    CONST.IOU.ACTION.CREATE,
    iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
    initialTransactionID,
    activePolicyExpenseChat?.reportID,
    ),
    ),
    );
    } else {
    navigateToParticipantPage(iouType, initialTransactionID, reportID);
    }
    },

    However, it did not check for domain-controlled preferred policies (via usePreferredPolicy hook), which are set through security group settings in Expensify Classic when admins configure preferred workspaces for domain groups.

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

    1. We can get restricted status and preferred policy by using usePreferredPolicy hook
    const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy();
    1. Then we check if user is restricted to a preferred policy (domain-controlled workspace), If so, skip the participant selector and go directly to confirmation with the preferred policy here

    Important: We should check condition separately like this to instead of else here to prevent wrong priority - default expense policy takes precedence over domain-controlled preferred policy

                if (iouType === CONST.IOU.TYPE.CREATE && isRestrictedToPreferredPolicy && preferredPolicyID) {
                    const preferredPolicyExpenseChat = getPolicyExpenseChat(currentUserPersonalDetails.accountID, preferredPolicyID);
                    if (preferredPolicyExpenseChat) {
                        const setParticipantsPromises = files.map((receiptFile) => {
                            setTransactionReport(receiptFile.transactionID, {reportID: preferredPolicyExpenseChat.reportID}, true);
                            return setMoneyRequestParticipantsFromReport(receiptFile.transactionID, preferredPolicyExpenseChat);
                        });
                        Promise.all(setParticipantsPromises).then(() =>
                            Navigation.navigate(
                                ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(
                                    CONST.IOU.ACTION.CREATE,
                                    CONST.IOU.TYPE.SUBMIT,
                                    initialTransactionID,
                                    preferredPolicyExpenseChat.reportID,
                                ),
                            ),
                        );
                        return;
                    }
                }


    We should do similarly with native file to make sure it works on native platform as well

    What alternative solutions did you explore? (Optional)

    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.

  11. github-actions commented on Nov 27, 2025

    @github-actions
    Contributor

    ⚠️ @lorretheboy Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  12. 21 remaining items

  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed
    ReviewingHas a PR in review
    on Mar 3, 2026
  14. lydiabarclay commented on Mar 3, 2026

    @lydiabarclay
    Contributor

    @luacmartins who needs payment here? @nkdengineer and @suneox, or just @suneox ?

  15. luacmartins commented on Mar 3, 2026

    @luacmartins
    Contributor

    Both

  16. lydiabarclay commented on Mar 4, 2026

    @lydiabarclay
    Contributor

    @suneox can you please fill out a BZ checklist?

  17. lydiabarclay commented on Mar 4, 2026

    @lydiabarclay
    Contributor

    Payment Summary

    Contributor: @nkdengineer due $250 via NewDot
    Contributor+: @suneox due $250 via NewDot

    ✅ Regression test filed

  18. suneox commented on Mar 6, 2026

    @suneox
    Contributor

    BugZero Checklist:

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

      Link to comment: Could not found offending PR, the bug is a missed case in existing stable code that has been in production for a long time on both Hybrid & NewDot so i think this is a feature gap

    • [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:

    • [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/608910

    Regression Test Proposal

    Precondition:

    • As an Admin, set up a domain workspace with a domain group
    • Set a Preferred workspace for the domain group on OldDot
    • Add a test user to the domain group (user will be restricted to the preferred workspace)

    Test:

    1. Log in with the domain-controlled test user account
    2. Long tap the Expensify app icon and select "SmartScan"
    3. Tap the green button to take a photo or upload an image
    4. Verify that you are redirected directly to the expense details/confirmation page without seeing the participant selector
    5. Verify that the Preferred workspace is automatically selected as the participant

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-6877-a076-bcc9-c17290967a94
  19. trjExpensify commented on Mar 6, 2026

    @trjExpensify
    Contributor

    approved $250 for @suneox

  20. moved this from MEDIUM or LOW to Done in [#whatsnext] #migrateon Mar 7, 2026
  21. twisterdotcom commented on Mar 11, 2026

    @twisterdotcom
    Contributor

    @nkdengineer has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-9dcd-a80c-88a1-b01fa47a6c74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions