Expense - Expense is created in another report with error when Submissions are disabled#94386
Expense - Expense is created in another report with error when Submissions are disabled#94386thelullabyy wants to merge 2 commits into
Conversation
…ctly routed. Update tests to verify that expenses with the current user as the sole recipient are processed as self-DM track expenses, preventing erroneous money request submissions
|
@codex review |
| const selectedParticipantsForRequest = iouType === CONST.IOU.TYPE.SPLIT ? splitParticipants : selectedParticipants; | ||
|
|
||
| const soleSelectedParticipant = selectedParticipants.length === 1 ? selectedParticipants.at(0) : undefined; | ||
| const isSelfDMDestination = |
There was a problem hiding this comment.
Old flow: the amount step (AmountSubmission) resolves the destination before navigating, and when the target is the self-DM it navigates to the confirmation with iouType: TRACK baked into the route. So the confirmation reads TRACK reliably → trackExpense.
New flow: the confirmation is embedded, and the conversion to TRACK happens after mount via an async navigation.setParams({iouType: TRACK}). createTransaction decides trackExpense vs requestMoney purely from that route iouType. When the conversion hasn't landed at submit time, it falls through to requestMoney with the current user as recipient → backend rejects with "you cannot request money from yourself."
There was a problem hiding this comment.
We should derive the track decision from the resolved participant (the same signal the old flow uses: destination is the self-DM), not the async route iouType
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Checked the draft — the approach looks correct, and you're right that my earlier proposal was aimed at the wrong layer. 👍 Why my proposal missed it: I theorized the expense was being routed to a policy expense chat because of a stale Your fix addresses exactly that gap. Deciding CI is green (the two A couple of optional, non-blocking thoughts:
Thanks for digging into this and correcting the direction. |
|
I reviewed this — the approach is sound and at the right layer, and you correctly identified that my earlier proposal was aimed at the wrong place. Quick reconciliation for the record:
Your fix encodes the correct invariant directly at the submission boundary: an expense whose only recipient is the current user can never be a money request, so it must be a track expense. Catching it in A few things worth tightening before it goes up for review:
Net: I agree with this direction over my earlier |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03a31d01ac
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| if (!isPerDiemRequest && (isTrackExpense || isCategorizingTrackExpense || isSharingTrackExpense)) { | ||
| if (!isPerDiemRequest && (isTrackExpense || isCategorizingTrackExpense || isSharingTrackExpense || isSelfDMDestination)) { |
There was a problem hiding this comment.
Update destination report when routing to self-DM
When the only recipient is the current user but the route iouType is still CREATE/REQUEST from another report, this branch now writes the expense through trackExpense to the self-DM, while IOURequestStepConfirmation still derives destinationReportID from the route report?.reportID unless iouType is already TRACK. On narrow/RHP dismiss-first paths the orchestrator reveals that stale destination and calls createTransaction(..., false), so the post-create cleanup navigation is skipped after this line and the user is left in the original report even though the expense was created in the self-DM. Please make the destination report calculation use the same self-DM condition before enabling this branch.
Useful? React with 👍 / 👎.
Explanation of Change
Fixed Issues
$ #94282
PROPOSAL: N/A
Tests
Precondition:
newManualExpenseFlowbetaOffline tests
QA Steps
Precondition:
newManualExpenseFlowbetaPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-06-24.at.01.29.33.mov
Android: mWeb Chrome
Screen.Recording.2026-06-24.at.01.30.45.mov
iOS: Native
Screen.Recording.2026-06-24.at.01.34.15.mov
iOS: mWeb Safari
Screen.Recording.2026-06-24.at.01.35.11.mov
MacOS: Chrome / Safari
Screen.Recording.2026-06-23.at.23.03.13.mov