Repository navigation
Open a member's unreported expense from Search as an admin - #104766
Conversation
An unreported expense lives in its owner's self DM. Opening one without a transaction thread built the thread in the viewer's own self DM, so the owner guard bailed out and an admin's click on a member's row did nothing. Search already returns the IOU action with the owner's self DM as its reportID, so the thread is now parented there and the owner's IOU action is merged into Onyx so the expense renders optimistically.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48f6f9a288
ℹ️ 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".
The owner's IOU action was written straight to Onyx, and OpenReport's failure data only reset childType, so after a failed open the action kept pointing at the dead thread. Every later click reopened it, and after the error was dismissed the row led to a not found page. Nothing from the server repairs another member's self DM, so the action now goes through OpenReport's optimistic data and its childReportID is cleared on failure.
Report 0 is the unreported sentinel, not a chat, so an IOU action carrying it falls back to the current user's self DM instead of parenting the thread under a bogus report.
# Conflicts: # src/libs/SearchUIUtils.ts
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-10-30.at.18.11.39.mov |
|
@mukhrr why haven't you included any videos in the OP? |
oh sorry. let me upload them quickly |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
mollfpr
left a comment
There was a problem hiding this comment.
Nice work, the logic looks good!
Co-authored-by: Mohammad Luthfi Fathur Rahman <luthfi@expensify.com>
|
@mollfpr cool! i think we are good to merge now? |
|
@lakchote @trjExpensify do you mind reviewing the PR before I merge? 🙇 |
@trjExpensify hmm unreported expense thread belongs to member's self DM, so it shows. I think we should hide it for self DM threads? |
|
It's a thread for an expense, I don't think we should have that indicator inside an expense no matter where the expense is. |
# Conflicts: # tests/unit/Search/SearchUIUtilsTest.ts
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 lakchote has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/lakchote in version: 9.5.33-0 🚀
|
|
Deploy Blocker #106253 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.5.33-1 🚀
Bundle Size Analysis (Sentry): |
|
|
||
| // The viewer doesn't have another member's self DM loaded, and the thread only needs its ID as the parent | ||
| if (!reportToUse && !isOwnedByCurrentUser) { | ||
| reportToUse = {reportID: selfDMReportID}; |
There was a problem hiding this comment.
Coming from #106253.
This PR allows an admin to open a member's unreported expense that doesn't have a thread yet. It builds the thread with only the self DM's ID as the parent. However, canJoinChat and canLeaveChat need the parent to be the owner's self DM to recognize it as a tracked expense thread.
Since the admin doesn't have access to that report, the thread was treated as a regular chat thread. As a result, Join appeared on the expense details page, and clicking Leave redirected the admin to the inaccessible self DM ("Not here").
Fixed in #106272.

Explanation of Change
When an admin clicked a member's unreported expense in Search and the expense had no transaction thread yet, nothing happened, because the thread could only be created in the viewer's own self DM. The thread is now created in the owner's self DM, using the ID Search already returns on the IOU action.
Fixed Issues
$ #101591
PROPOSAL: #101591 (comment)
Tests
Preconditions: admin A owns a workspace and employee B is a member with the user role. Opening the thread also needs the backend change that lets an admin create it under B's self DM; without it the expense still opens but shows "Unexpected error creating this chat".
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged theExpensify/designteam so 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
android.app.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.app.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4