-
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 couple of manual request bugs #19194
Conversation
|
@srikarparsi 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] |
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.
Please add the fixes and tests when you have a moment. It's looking good though. Here's what I tested:
- Error when settling request from header without viewing chat report first ✅
- Pay button shouldn't exist in the expense view header, only the expenseReport view header ✅
- Settled IOUPreview added to expense/iouReport ✅
- ReportPreview total is reset to $0.00 after signing out ✅
src/components/MoneyRequestHeader.js
Outdated
!isSettled && (Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(props.report) && lodashGet(props.session, 'email', null) === props.report.managerEmail)); | ||
!isSettled && | ||
!props.isSingleTransactionView && | ||
(Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(props.report) && lodashGet(props.session, 'email', null) === props.report.managerEmail)); |
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.
That's a whole lotta logic. Maybe consider a helper or separate condition within the component for the final line
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.
split it up a bit!
@@ -114,10 +114,12 @@ const ReportPreview = (props) => { | |||
> | |||
<View style={[styles.flexShrink1]}> | |||
{props.iouReport.hasOutstandingIOU ? ( | |||
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>{props.translate('iou.payerOwesAmount', {payer: managerName, amount: reportAmount})}</Text> | |||
<Text style={[styles.chatItemMessage, styles.cursorPointer]}> | |||
{lodashGet(message, 'html', props.translate('iou.payerOwesAmount', {payer: managerName, amount: reportAmount}))} |
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.
Ah one small issue with using the HTML is that the 'settled up' String should be lower case. But we can fix that here later 👍
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.
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.
The html message is not translated. Should we translate the default message in this case?
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.
Left a couple of comments. Thanks for working on these.
@@ -114,10 +114,12 @@ const ReportPreview = (props) => { | |||
> | |||
<View style={[styles.flexShrink1]}> | |||
{props.iouReport.hasOutstandingIOU ? ( | |||
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>{props.translate('iou.payerOwesAmount', {payer: managerName, amount: reportAmount})}</Text> | |||
<Text style={[styles.chatItemMessage, styles.cursorPointer]}> | |||
{lodashGet(message, 'html', props.translate('iou.payerOwesAmount', {payer: managerName, amount: reportAmount}))} |
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.
The html message is not translated. Should we translate the default message in this case?
) : ( | ||
<View style={[styles.flexRow]}> | ||
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>{props.translate('iou.payerSettled', {amount: reportAmount})}</Text> | ||
<Text style={[styles.chatItemMessage, styles.cursorPointer]}>{lodashGet(message, 'html', props.translate('iou.payerSettled', {amount: reportAmount}))}</Text> |
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.
same here
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.
Lets just translate it, I dont think it causes any harm. Again, we should not get to the point we will need the default there
@@ -1014,7 +1016,6 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType | |||
* @returns {Object} | |||
*/ | |||
function getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentMethodType) { | |||
const reportPreviewAction = ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); |
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.
Why are we removing the optimistic action?
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.
This is what was in the end causing the bugs with payment. if you sign in and navigate dirrectly to the IOU report and click pay, we dont have the report preview action as it was not treated as the parent report action -> hence the auth change. So the app crashed here/ you could not pay.
const shouldShowSettlementButton = | ||
!isSettled && (Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(props.report) && lodashGet(props.session, 'email', null) === props.report.managerEmail)); | ||
const isPayer = Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(props.report) && lodashGet(props.session, 'email', null) === props.report.managerEmail); | ||
const shouldShowSettlementButton = !isSettled && !props.isSingleTransactionView && isPayer; |
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.
NAB: isPayer
being the first condition here would be a bit more readable. But only do this if you need to make other changes!
@Julesssss @mollfpr is doing the testing right now |
Okay, I'll stop. Tested everything apart from the native apps. |
Reviewer Checklist
Screenshots/VideosWebPayment button on admin money request report header No payment button on transaction thread Settling up requests 19194.Web.-.Settling.up.requests.movMobile Web - ChromeCorrect settled message Payment button on admin 19194.mWeb.Chrome.-.Payment.button.on.admin.movSettling up requests 19194.mWeb.Chrome.-.Settling.up.requests.movMobile Web - SafariCorrect settled message Payment button on admin 19194.mWeb.Safari.-.Payment.button.on.admin.mp4Settling up requests 19194.mWeb.Safari.-.Settling.up.requests.mp4DesktopPayment button on admin header and no payment button on money request thread 19194.Desktop.-.Payment.button.on.admin.movSettling up requests 19194.Desktop.-.Settling.up.requests.moviOSAndroid |
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.
Tests well 👍
Fix couple of manual request bugs (cherry picked from commit 40d992f)
…-19194 🍒 Cherry pick PR #19194 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 1.3.16-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
1 similar comment
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀
|
Details
Couple of issues fixed here:
Fixed Issues
$ #19191
$ #19189
Tests
Correct settled message
No payment button on transaction thread
Settling up requests
Offline tests
N/A
QA Steps
Same as the test above
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
Web
admin cant see the button on transaction thread
Mobile Web - Chrome
Cannot log in
Mobile Web - Safari
Desktop
iOS
Correct settled message
Android