-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix: IOU - "TBD" is missing in the IOU details of the "Amount" field in offline mode #29892
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
Changes from all commits
a2e1252
41186b9
4851bcb
55c9366
e012a67
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 |
|---|---|---|
|
|
@@ -660,6 +660,17 @@ function hasSingleParticipant(report) { | |
| return report && report.participantAccountIDs && report.participantAccountIDs.length === 1; | ||
| } | ||
|
|
||
| /** | ||
| * Checks whether all the transactions linked to the IOU report are of the Distance Request type | ||
| * | ||
| * @param {string|null} iouReportID | ||
| * @returns {boolean} | ||
| */ | ||
| function hasOnlyDistanceRequestTransactions(iouReportID) { | ||
| const allTransactions = TransactionUtils.getAllReportTransactions(iouReportID); | ||
| return _.all(allTransactions, (transaction) => TransactionUtils.isDistanceRequest(transaction)); | ||
| } | ||
|
|
||
| /** | ||
| * If the report is a thread and has a chat type set, it is a workspace chat. | ||
| * | ||
|
|
@@ -1415,23 +1426,23 @@ function getPolicyExpenseChatName(report, policy = undefined) { | |
| } | ||
|
|
||
| /** | ||
| * Get the title for a IOU or expense chat which will be showing the payer and the amount | ||
| * Get the title for an IOU or expense chat which will be showing the payer and the amount | ||
| * | ||
| * @param {Object} report | ||
| * @param {Object} [policy] | ||
| * @returns {String} | ||
| */ | ||
| function getMoneyRequestReportName(report, policy = undefined) { | ||
| const moneyRequestTotal = getMoneyRequestReimbursableTotal(report); | ||
| const formattedAmount = CurrencyUtils.convertToDisplayString(moneyRequestTotal, report.currency); | ||
| const formattedAmount = CurrencyUtils.convertToDisplayString(moneyRequestTotal, report.currency, hasOnlyDistanceRequestTransactions(report.reportID)); | ||
| const payerName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report.managerID); | ||
| const payerPaidAmountMesssage = Localize.translateLocal('iou.payerPaidAmount', { | ||
| const payerPaidAmountMessage = Localize.translateLocal('iou.payerPaidAmount', { | ||
| payer: payerName, | ||
| amount: formattedAmount, | ||
| }); | ||
|
|
||
| if (report.isWaitingOnBankAccount) { | ||
| return `${payerPaidAmountMesssage} • ${Localize.translateLocal('iou.pending')}`; | ||
| return `${payerPaidAmountMessage} • ${Localize.translateLocal('iou.pending')}`; | ||
| } | ||
|
|
||
| if (hasNonReimbursableTransactions(report.reportID)) { | ||
|
|
@@ -1442,7 +1453,7 @@ function getMoneyRequestReportName(report, policy = undefined) { | |
| return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount}); | ||
| } | ||
|
|
||
| return payerPaidAmountMesssage; | ||
| return payerPaidAmountMessage; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1527,7 +1538,7 @@ function canEditReportAction(reportAction) { | |
| /** | ||
| * Gets all transactions on an IOU report with a receipt | ||
| * | ||
| * @param {Object|null} iouReportID | ||
| * @param {string|null} iouReportID | ||
|
Collaborator
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. Are we sure we're getting a string here? I thought transactions is an object?
Contributor
Author
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. We're not getting – it's the input parameter of the function, |
||
| * @returns {[Object]} | ||
| */ | ||
| function getTransactionsWithReceipts(iouReportID) { | ||
|
|
@@ -1593,7 +1604,7 @@ function getTransactionReportName(reportAction) { | |
| const {amount, currency, comment} = getTransactionDetails(transaction); | ||
|
|
||
| return Localize.translateLocal(ReportActionsUtils.isSentMoneyReportAction(reportAction) ? 'iou.threadSentMoneyReportName' : 'iou.threadRequestReportName', { | ||
| formattedAmount: CurrencyUtils.convertToDisplayString(amount, currency), | ||
| formattedAmount: CurrencyUtils.convertToDisplayString(amount, currency, TransactionUtils.isDistanceRequest(transaction)), | ||
| comment, | ||
| }); | ||
| } | ||
|
|
@@ -4079,6 +4090,7 @@ export { | |
| buildTransactionThread, | ||
| areAllRequestsBeingSmartScanned, | ||
| getTransactionsWithReceipts, | ||
| hasOnlyDistanceRequestTransactions, | ||
| hasNonReimbursableTransactions, | ||
| hasMissingSmartscanFields, | ||
| getIOUReportActionDisplayMessage, | ||
|
|
||
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 can't find the link or doc, but I thought we're going to prioritize using the built-in methods over lodash if they exist. We could use
@Julesssss Can you confirm this?
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.
As far as I understand, this is more related to TypeScript, as it's more fail-safe. But if you insist, I can change to
.everyhereThere 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 am also not 100% sure on this one.
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.
Then I would like to keep it as is until the file is migrated to TypeScript, just to make it consistent with the rest of the functions
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 stick with the current solution