Skip to content

Allow changing the workspace on the confirmation page when scanning from the camera button - #102768

Closed
MelvinBot wants to merge 1 commit into
mainfrom
claude-cameraButtonEditableWorkspace
Closed

MelvinBot wants to merge 1 commit into
mainfrom
claude-cameraButtonEditableWorkspace

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

The bottom-tab camera button (and the desktop floating receipt button) starts a scan with the active workspace chat as the route reportID, instead of a generated one like FAB → Create expense → Scan. Because of that, useResetIOUType sets isFromGlobalCreate: false on the draft, and useParticipantSection only lets the user edit the workspace row when isFromGlobalCreate is true. So users couldn't switch workspaces on the confirmation page.

Both flows already go through navigateGlobalCreate after the receipt is captured, which assigns the draft to the default workspace chat. This PR also sets isFromGlobalCreate: true on the drafts there. That way:

  • The camera button still pre-fills the default workspace, exactly as before.
  • The workspace row is tappable, like in the FAB scan flow. Picking another workspace updates the draft's participants and reportID, and submission uses those, so the expense goes to the chosen workspace.
  • The existing isRestrictedToPreferredPolicy and test-receipt locks in useParticipantSection still apply.
  • FAB Quick Actions are not affected. They use iouType SUBMIT/TRACK/SPLIT with an existing report, so they never reach navigateGlobalCreate. The FAB scan and receipt drop flows already have isFromGlobalCreate: true, so this is a no-op for them.

Added unit tests in tests/unit/NavigateGlobalCreateTest.tsx for both branches of navigateGlobalCreate (default workspace and preserved participants).

Fixed Issues

$ #102764
PROPOSAL: #102764

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.

  • 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 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 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)
  • 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)
  • 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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

…rom the camera button

Co-authored-by: Garrett Knight <garrettmknight@users.noreply.github.com>
@MelvinBot

MelvinBot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

The PR's Tests section is still a TODO, so I ran the expected-result steps from the linked issue. I set up two workspaces and confirmed the floating receipt button opens the Scan upload dropzone, but the web test harness can't select a file in the file chooser, so I couldn't reach the Confirm details page where this fix applies.
Create expense modal with Scan tab and Choose files dropzone after clicking the floating receipt button

Step Status
Tap the camera button and take or upload a receipt; the Confirm details page opens.Clicking the desktop floating Scan receipt button opened the Create expense modal with the Scan tab active and a Choose files dropzone. The web harness has no supported way to pick a file in the native file chooser, so the Confirm details page was never reached.
Create expense modal with Scan tab and Choose files dropzone after clicking the floating receipt button
❌
On Confirm details, the workspace row shows the default workspace.Not reached because the receipt upload was blocked.
❌
The workspace row is tappable; pick another workspace and confirm the row updates.Not reached because the receipt upload was blocked.
❌
Submit; the expense lands in the chosen workspace's chat, not the default one.Not reached because the receipt upload was blocked.
❌
No JS console errors related to this flow.The web harness can't read the browser console. No in-app error banners appeared during onboarding, workspace creation, or opening the Scan modal, but that doesn't confirm the console is clean.
❌

view run · view recording

@MelvinBot

MelvinBot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ✅ pass

The PR's Tests section is still a TODO, so I ran the expected-result steps from the linked issue. On Android, the bottom-tab camera button pre-fills the default workspace, the workspace row on Confirm details can be changed, and the submitted expense lands in the chosen workspace's chat.
New expense report inside the second workspace chat

Step Status
Tap the bottom tab camera button and take or upload a receipt; the Confirm details page opens.Pressed the Scan receipt tab button, granted camera permission, and took a photo with the emulator camera. The app opened the Confirm details page.
Confirm details showing default workspace after capturing a receipt from the camera button
✅
On Confirm details, the workspace row shows the default workspace.The workspace row showed "Tester Tester's Workspace" (the default) with "Submits to Tester Tester" and a right chevron.
Confirm details showing default workspace after capturing a receipt from the camera button
✅
The workspace row is tappable; pick another workspace and confirm the row updates.Tapping the row opened a Choose recipient picker listing both workspaces. Selecting "Tester Tester's Workspace 1" returned to Confirm details with the row showing that workspace.
Workspace picker listing both workspacesConfirm details row updated to the second workspace
✅
Submit; the expense lands in the chosen workspace's chat, not the default one.After tapping Create expense, the Inbox showed "Tester Tester's Workspace 1 • Expense Report 2026-10-01" with 1 expense. The default workspace's expense chat stayed empty.
New expense report inside the second workspace chat
✅
No JS console errors related to this flow.No error banners, toasts, or crash dialogs appeared during capture, workspace switching, or submission. Device logs were not captured for the full run, so this pass is based on what was visible on screen, not on a log check.
✅

view run · view recording

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants