Skip to content

[Submit] Fix details-page submit options and scope draft-workspace name resolution#96136

Draft
abzokhattab wants to merge 2 commits into
Expensify:mainfrom
abzokhattab:abzokhattab-scope-getpolicyname-92704
Draft

[Submit] Fix details-page submit options and scope draft-workspace name resolution#96136
abzokhattab wants to merge 2 commits into
Expensify:mainfrom
abzokhattab:abzokhattab-scope-getpolicyname-92704

Conversation

@abzokhattab

Copy link
Copy Markdown
Contributor

Explanation of Change

Follow-up to #94319 (Submit → "Submit to my employer"). This PR contains two targeted changes:

1. Show the two submit options on the expense details page (#96085)
The track-expense details page menu still rendered the single "Submit to someone" option, while the whisper (ChatActionableButtons) already split it into "Submit to a friend" / "Submit to my employer". This mirrors that split on the details page, gated behind the same SUBMIT_2026 beta, so non-beta users see the unchanged single option.

2. Scope the draft-workspace name resolution to be targeted and safe
The original feature broadened getPolicyName's early-bail guard with oldPolicyName to resolve the "To" name for a freshly created draft workspace (zero-workspace "Submit to my employer"). That changed behavior for all zero-policy users. This replaces it with a targeted approach:

  • getPolicyName now honors the policy argument a caller explicitly passes (instead of bailing when policies/allPolicies are empty). This only affects the case where a caller passed a valid policy but everything else was empty — previously that wrongly returned "Unavailable workspace".
  • IOURequestStepConfirmation forwards the (draft) transaction policy for the matching participant, so the draft workspace name resolves through the normal path.

Both changes are dead code paths for normal, non-draft flows (verified by the existing getPolicyName unit tests, all passing).

Fixed Issues

$ #96085
PROPOSAL:

Tests

  1. Enable the SUBMIT_2026 beta.
  2. Create a manual expense and submit it to your Self DM.
  3. On the track-expense whisper, verify "Submit to a friend" and "Submit to my employer" appear.
  4. Open the expense, tap the header to open the details page.
  5. Verify the details page shows "Submit to a friend" and "Submit to my employer" (not "Submit to someone").
  6. With no submit-enabled workspaces, tap "Submit to my employer" and verify the confirmation "To" shows the new workspace name (not "Unavailable workspace").
  7. Disable the beta and verify the details page again shows the single "Submit to someone" option (no regression).
  8. Verify that no errors appear in the JS console.

Offline tests

Same as tests — the two-option menu and name resolution are client-side and work offline.

QA Steps

Same as tests.

  • 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 turned off my network connection and tested it while offline
    • I tested this PR with a High Traffic account against the staging or production API
  • 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
  • I followed proper code patterns
  • I added unit tests for any new feature or bug fix in this PR

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Resolve the confirmation "To" name for a freshly created draft workspace
(zero-workspace "Submit to my employer") via the policy explicitly passed to
getPolicyName instead of broadening the early-bail guard with oldPolicyName,
which affected all zero-policy users. The confirmation now forwards the draft
policy for the matching participant so the name resolves through the normal path.
The track-expense details page menu still showed the single "Submit to
someone" option. Split it into "Submit to a friend" / "Submit to my employer"
behind the SUBMIT_2026 beta, matching the whisper (ChatActionableButtons).
Fixes Expensify#96085.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant