-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow creating Distance request from expense reports #30881
fix: allow creating Distance request from expense reports #30881
Conversation
@thesahindia 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2023-11-07.at.2.15.54.PM.movAndroid: mWeb ChromeScreen.Recording.2023-11-07.at.2.13.00.PM.moviOS: NativeScreen.Recording.2023-11-07.at.2.25.09.PM.moviOS: mWeb SafariScreen.Recording.2023-11-07.at.2.20.11.PM.movMacOS: Chrome / SafariScreen.Recording.2023-11-06.at.10.57.24.PM.movMacOS: DesktopScreen.Recording.2023-11-07.at.2.26.26.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent thank you
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@@ -621,12 +621,16 @@ function getMoneyRequestInformation( | |||
* @param {Boolean} [billable] | |||
*/ | |||
function createDistanceRequest(report, participant, comment, created, transactionID, category, tag, amount, currency, merchant, billable) { | |||
// If the report is an iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function | |||
const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); | |||
const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report.chatReportID) : report; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an incorrect change. Why not pass the proper report object to createDistanceRequest()
in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the same approach when creating a regular money request:
Lines 847 to 851 in 1dc4593
// If the report is iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function | |
const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); | |
const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report.chatReportID) : report; | |
const {payerAccountID, payerEmail, iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = | |
getMoneyRequestInformation(currentChatReport, participant, comment, amount, currency, created, merchant, payeeAccountID, payeeEmail, receipt, undefined, category, tag, billable); |
What exactly do you mean by a "proper report object" here: is it the one we are fetching as currentChatReport
? If so, we'll still need to tell apart a request created from a chat and the one created from an expense report so that we can navigate the user properly. Would you have any suggestions for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just because we do it somewhere else, doesn't mean it's right. It just means that you get to fix it in two places 🎉
What I am saying is that the logic that you added inside the method should have been done outside of the method, and then the proper "chat report" is what is passed to the method in the report
param.
If you need something else for the navigation, then I would consider:
- Moving navigation out of this method (I also dislike this method is doing navigation, it is an anti-pattern of separating concerns)
- Using a different param to control the navigation specifically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Since this PR is already merged, would you want me to create a cleanup one?
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.97-7 🚀
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 1.3.98-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.98-5 🚀
|
Details
Allow creating Distance request from expense reports
Fixed Issues
$ #30407
PROPOSAL: #30407 (comment)
Tests
Same as QA.
Offline tests
Same as QA.
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android-compressed.mp4
Android: mWeb Chrome
chrome-compressed.mp4
iOS: Native
iOS.mov
iOS: mWeb Safari
safari.mp4
MacOS: Chrome / Safari
web-compressed.mp4
MacOS: Desktop
Desktop-compressed.mp4