Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,7 @@ function buildOptimisticExpenseReport(chatReportID, policyID, payeeAccountID, to
}

/**
* @param {String} iouReportID - the report ID of the IOU report the action belongs to
* @param {String} type - IOUReportAction type. Can be oneOf(create, decline, cancel, pay, split)
* @param {Number} total - IOU total in cents
* @param {String} comment - IOU comment
Expand All @@ -1811,8 +1812,8 @@ function buildOptimisticExpenseReport(chatReportID, policyID, payeeAccountID, to
* @param {Boolean} isSettlingUp - Whether we are settling up an IOU
* @returns {Array}
*/
function getIOUReportActionMessage(type, total, comment, currency, paymentType = '', isSettlingUp = false) {
const amount = CurrencyUtils.convertToDisplayString(total, currency);
function getIOUReportActionMessage(iouReportID, type, total, comment, currency, paymentType = '', isSettlingUp = false) {
let amount = CurrencyUtils.convertToDisplayString(total, currency);
let paymentMethodMessage;
switch (paymentType) {
case CONST.IOU.PAYMENT_TYPE.ELSEWHERE:
Expand All @@ -1838,6 +1839,7 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType =
iouMessage = `deleted the ${amount} request${comment && ` for ${comment}`}`;
break;
case CONST.IOU.REPORT_ACTION_TYPE.PAY:
amount = CurrencyUtils.convertToDisplayString(getMoneyRequestTotal(getReport(iouReportID)), currency);
Comment thread
mountiny marked this conversation as resolved.
Comment thread
mountiny marked this conversation as resolved.
iouMessage = isSettlingUp ? `paid ${amount}${paymentMethodMessage}` : `sent ${amount}${comment && ` for ${comment}`}${paymentMethodMessage}`;
break;
default:
Expand Down Expand Up @@ -1931,7 +1933,7 @@ function buildOptimisticIOUReportAction(
avatar: lodashGet(currentUserPersonalDetails, 'avatar', UserUtils.getDefaultAvatar(currentUserAccountID)),
isAttachment: false,
originalMessage,
message: getIOUReportActionMessage(type, amount, comment, currency, paymentType, isSettlingUp),
message: getIOUReportActionMessage(iouReportID, type, amount, comment, currency, paymentType, isSettlingUp),
person: [
{
style: 'strong',
Expand Down