Repository navigation
Call MoveIOUToPolicy even when policy expense chat is not loaded - #69788
Conversation
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
This comment was marked as outdated.
This comment was marked as outdated.
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
This comment was marked as outdated.
This comment was marked as outdated.
| optimisticData.push({ | ||
| onyxMethod: Onyx.METHOD.SET, | ||
| key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticExpenseChatReportID}`, | ||
| value: { | ||
| reportID: optimisticExpenseChatReportID, | ||
| policyID, | ||
| ownerAccountID: employeeAccountID, | ||
| type: CONST.REPORT.TYPE.CHAT, | ||
| chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
I will remove the optimistic updates for now as the BE requires an update. I will instead break this into 2 PRs as described
| const isMember = isPolicyMember(policy, getLoginByAccountID(iouReport.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID)); | ||
| if (!isMember) { | ||
| const {policyExpenseChatReportID: newPolicyExpenseChatReportID} = moveIOUReportToPolicyAndInviteSubmitter(iouReport.reportID, policy.id, formatPhoneNumber) ?? {}; | ||
| savePreferredPaymentMethod(iouReport.policyID, policy.id, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[policy.id]); | ||
| Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(newPolicyExpenseChatReportID)); | ||
| if (newPolicyExpenseChatReportID) { | ||
| Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(newPolicyExpenseChatReportID)); | ||
| } | ||
| } else { | ||
| moveIOUReportToPolicy(iouReport.reportID, policy.id, true); | ||
| const {policyExpenseChatReportID, useTemporaryOptimisticExpenseChatReportID} = moveIOUReportToPolicy(iouReport, policy, true) ?? {}; |
There was a problem hiding this comment.
this is the main change
| const useTemporaryOptimisticExpenseChatReportID = !expenseChatReportId; | ||
| const optimisticExpenseChatReportID = expenseChatReportId ?? generateReportID(); |
There was a problem hiding this comment.
as with this default to an optimisticID
|
@getusha Could you review this PR while I'm working on bulk pay? |
|
LMK when this is ready to test and I will do that 👍 |
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
This comment was marked as outdated.
This comment was marked as outdated.
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
|
Let us know your thoughts @getusha |
|
@getusha or @hungvu193 this PR needs final review if you're available |
|
Reviewing |
|
@getusha yeah I can merge main if needed, but no styles are updated here |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-rec-45.webmAndroid: mWeb Chromeandroid-rec-42.webmiOS: HybridAppSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-09-25.at.14.33.03.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-09-25.at.14.04.59.mp4MacOS: Chrome / SafariScreen.Recording.2025-09-24.at.3.56.46.in.the.afternoon.movMacOS: DesktopScreen.Recording.2025-09-25.at.2.29.49.in.the.afternoon.mov |
|
@MarioExpensify Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
17bca9f
|
@Valforte fixed conflicts |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
There is this ESLint error now |
|
Looks like all checks passing now. Could you re-review @Valforte ? |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Valforte in version: 9.2.19-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.2.19-3 🚀
|

Explanation of Change
Screen.Recording.2025-09-15.at.3.11.37.PM.mov
We cannot guarantee that an admin will have the policy expense chat IDs for members in ONYX at any given time.
Therefore we are:
preexistingReportIDis returned from BE in MoveIOUToExistingPolicy if the policy expense chat is not passedTo keep things clean, in the next PR we will handle the offline optimistic data. From my testing, there may be one more BE fix to merge, so let's merge this and handle the offline opening of the report in a follow up. The app will simply not open the report optimistically if it is not loaded.
Fixed Issues
$ #68027
PROPOSAL:
Tests
See QA
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
First: Test Move IOU and invite
From B/EMPLOYEE:
send a DM to A/PAYER
In the DM chat, create a USD
From A/PAYER:
Click on the dropdown in the payment button, click "pay via workspace"
[X]✅ Verify that a policy Expense chat is created and expense is moved
Second: Test Move IOU with Expense chat loaded
DO NOT LOG OUT FROM A/PAYER FOR THIS TEST
From B/EMPLOYEE:
send a second USD money request to A/PAYER
From A/PAYER:
Click on the dropdown in the payment button, click "pay via workspace"
[X]✅ Verify that expense is moved to existing policy expense chat
Third: Test Move IOU with Expense chat loaded
From B/EMPLOYEE:
send a third USD money request to A/PAYER
From A/PAYER:
Go to settings > troubleshoot > clear cache and restart
Click on the dropdown in the payment button, click "pay via workspace"
✅ Verify that "moved this report to workspace" is commented, but user is not navigated.
✅ Verify that clicking on " workspace" opens the policy expense chat
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop