-
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
Changes from 7 commits
6761446
a29f4bb
387a176
c4df4b3
d81c6d8
4201994
4d41619
326e0e4
f21c9bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ const ReportPreview = (props) => { | |
const isCurrentUserManager = managerEmail === lodashGet(props.session, 'email', null); | ||
return ( | ||
<View style={[styles.chatItemMessage, styles.mt4]}> | ||
{_.map(props.action.message, (index) => ( | ||
{_.map(props.action.message, (message, index) => ( | ||
<Pressable | ||
key={`ReportPreview-${props.action.reportActionID}-${index}`} | ||
onPress={() => { | ||
|
@@ -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 commentThe 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 commentThe 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 commentThe 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? |
||
</Text> | ||
) : ( | ||
<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 commentThe 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 commentThe 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 |
||
{!props.iouReport.hasOutstandingIOU && ( | ||
<Icon | ||
style={[styles.ml10]} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -882,6 +882,8 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType | |
optimisticTransaction.transactionID, | ||
paymentMethodType, | ||
optimisticIOUReport.reportID, | ||
false, | ||
true, | ||
); | ||
|
||
// First, add data that will be used in all cases | ||
|
@@ -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 commentThe 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 commentThe 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 optimisticTransaction = TransactionUtils.buildOptimisticTransaction(iouReport.total, iouReport.currency, iouReport.reportID); | ||
const optimisticIOUReportAction = ReportUtils.buildOptimisticIOUReportAction( | ||
CONST.IOU.REPORT_ACTION_TYPE.PAY, | ||
|
@@ -1042,15 +1043,6 @@ function getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentMetho | |
lastMessageHtml: optimisticIOUReportAction.message[0].html, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport.reportID}`, | ||
value: { | ||
[reportPreviewAction.reportActionID]: { | ||
created: DateUtils.getDBTime(), | ||
}, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, | ||
|
@@ -1104,15 +1096,6 @@ function getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentMetho | |
]; | ||
|
||
const failureData = [ | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport.reportID}`, | ||
value: { | ||
[reportPreviewAction.reportActionID]: { | ||
created: reportPreviewAction.created, | ||
}, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${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.
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!