Fix: Expenses moved to Self DM, display a Join button on top of report#76043
Fix: Expenses moved to Self DM, display a Join button on top of report#76043pecanoro merged 19 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@Krishna2323 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] |
src/libs/ReportUtils.ts
Outdated
| function isTrackExpenseReport(report: OnyxInputOrEntry<Report>): boolean { | ||
| if (isThread(report)) { | ||
| const selfDMReportID = findSelfDMReportID(); | ||
| const parentReport = getParentReport(report); |
There was a problem hiding this comment.
@nkdengineer we shouldn't use getParentReport. See #74738 (comment)
There was a problem hiding this comment.
@Krishna2323 To avoid unnecessary change in the PR, which can cause the regression, I create a new isTrackExpenseReportNew function.
7fa8ee7 to
a18adbc
Compare
| * A Track Expense Report is a thread where the parent the parentReportAction is a transaction, and | ||
| * parentReportAction has type of track. | ||
| */ | ||
| function isTrackExpenseReportNew(report: OnyxInputOrEntry<Report>, parentReport: OnyxInputOrEntry<Report>, parentReportAction: OnyxInputOrEntry<ReportAction>): boolean { |
There was a problem hiding this comment.
@pecanoro Is this fine to do? The current isTrackExpenseReport uses values from the Onyx.connect() method, and we want to avoid using those functions. Updating isTrackExpenseReport to use values passed from the UI can be complex and time-consuming. Let me know what you think about this.
Slack thread: https://expensify.slack.com/archives/C02NK2DQWUX/p1759913248186279
cc: @DylanDylann
There was a problem hiding this comment.
- If that we need to mark isTrackExpenseReport as deprecated
- So how do you ensure that your change in
isTrackExpenseReportfunction don't cause regression?
There was a problem hiding this comment.
So how do you ensure that your change in isTrackExpenseReport function don't cause regression?
What do you mean?
There was a problem hiding this comment.
Because you created a new function, we will need to migrate to this new function in other places later. But in the new function, you updated the logic. This update can cause regression in other places but we can't see that here because you only use isTrackExpenseReportNew in one place
There was a problem hiding this comment.
This update can cause regression in other places but we can't see that here because you only use isTrackExpenseReportNew in one place
It's just a better way to check the selfDM, so I don't think it can cause any regression.
There was a problem hiding this comment.
Thanks @DylanDylann, I think that's a better approach and has very low chances of causing regression.
There was a problem hiding this comment.
@nkdengineer could you please mark the old function as deprecated so it’s clear that we shouldn’t use it anymore?
There was a problem hiding this comment.
What is the plan to remove the other function? Do we need to create a new issue so someone can handle it?
There was a problem hiding this comment.
@pecanoro We can create a new issue for this. Happy to handle this if needed.
There was a problem hiding this comment.
What is the plan to remove the other function? Do we need to create a new issue so someone can handle it?
@pecanoro Do we want to create a new issue for this?
|
Completing the checklist... |
| * A Track Expense Report is a thread where the parent the parentReportAction is a transaction, and | ||
| * parentReportAction has type of track. | ||
| */ | ||
| function isTrackExpenseReportNew(report: OnyxInputOrEntry<Report>, parentReport: OnyxInputOrEntry<Report>, parentReportAction: OnyxInputOrEntry<ReportAction>): boolean { |
There was a problem hiding this comment.
@nkdengineer could you please mark the old function as deprecated so it’s clear that we shouldn’t use it anymore?
@nkdengineer please update this to |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid_native.mp4Android: mWeb Chromeandroid_chrome.mp4iOS: HybridAppios_native.mp4iOS: mWeb Safariios_safari.mp4MacOS: Chrome / Safariweb_chrome.mp4 |
|
After deleting the report from the workspace, the LHN shows two Self DMs. This is also reproducible on staging, so I don’t think we should block on it. Monosnap.screencast.2025-12-02.16-46-18.mp4 |
|
@nkdengineer there are conflicts. |
|
@Krishna2323 Updated. |
|
@nkdengineer we have conflicts now. |
|
@nkdengineer bump |
|
Updated. |
|
@pecanoro this one is ready for your review. Thanks! |
src/libs/ReportUtils.ts
Outdated
| parentReportAction: OnyxInputOrEntry<ReportAction>, | ||
| policy: OnyxInputOrEntry<Policy>, | ||
| isReportArchived = false, | ||
| parentReport?: Report, |
There was a problem hiding this comment.
If parentReportAction is not optional, why are we making parentReport optional?
There was a problem hiding this comment.
Just add as an optional parameter then we don't need to edit the unit test.
There was a problem hiding this comment.
I think it would be best, if possible, to make it mandatory rather than optional, to avoid confusion. I don't think changing the unit tests would be too painful, right?
There was a problem hiding this comment.
Got it, I will give an update soon.
| * A Track Expense Report is a thread where the parent the parentReportAction is a transaction, and | ||
| * parentReportAction has type of track. | ||
| */ | ||
| function isTrackExpenseReportNew(report: OnyxInputOrEntry<Report>, parentReport: OnyxInputOrEntry<Report>, parentReportAction: OnyxInputOrEntry<ReportAction>): boolean { |
There was a problem hiding this comment.
What is the plan to remove the other function? Do we need to create a new issue so someone can handle it?
|
@nkdengineer Friendly bump! I left a couple of questions in the review before |
|
Recent changes looks good to me! |
|
@nkdengineer we have conflicts now 👀 |
|
✋ 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/pecanoro in version: 9.2.79-0 🚀
|
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 9.2.81-0 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.2.81-5 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.2.81-5 🚀
|
Explanation of Change
Expenses moved to Self DM, display a Join button on top of report
Fixed Issues
$ #74897
PROPOSAL: #74897 (comment)
Tests
Offline tests
Same
QA Steps
Same as test
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))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.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
Screen.Recording.2025-11-25.at.23.29.46.mov
Android: mWeb Chrome
Screen.Recording.2025-11-25.at.23.32.08.mov
iOS: Native
Screen.Recording.2025-11-25.at.23.32.49.mov
iOS: mWeb Safari
Screen.Recording.2025-11-25.at.23.33.29.mov
MacOS: Chrome / Safari
Screen.Recording.2025-11-25.at.23.29.02.mov