From c9d14bed01a38b9b2f33ecb25475d0092f2d720a Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 7 Feb 2024 00:58:48 +0700 Subject: [PATCH 1/3] fix: Copy to clipboard on the system message for paid expense copies negative amount --- src/libs/actions/IOU.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index a7a82e642e62..2422247a2bbb 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3081,9 +3081,10 @@ function getSendMoneyParams( } function getPayMoneyRequestParams(chatReport: OnyxTypes.Report, iouReport: OnyxTypes.Report, recipient: Participant, paymentMethodType: PaymentMethodType): PayMoneyRequestData { + const total = iouReport.total ?? 0; const optimisticIOUReportAction = ReportUtils.buildOptimisticIOUReportAction( CONST.IOU.REPORT_ACTION_TYPE.PAY, - -(iouReport.total ?? 0), + ReportUtils.isExpenseReport(iouReport) ? -total : total, iouReport.currency ?? '', '', [recipient], From 46d580473ed81a33c621976b717b8c6c4e680576 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 14 Feb 2024 10:08:25 +0700 Subject: [PATCH 2/3] update test --- tests/actions/IOUTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index cb31afbf8f8f..11fb22db01b6 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -1742,7 +1742,7 @@ describe('actions/IOU', () => { }), ]), originalMessage: expect.objectContaining({ - amount: -amount, + amount: amount, paymentType: CONST.IOU.PAYMENT_TYPE.VBBA, type: 'pay', }), From 7581a42ea86e83fdd7526e0ea304f977f7c56ae1 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 14 Feb 2024 10:18:35 +0700 Subject: [PATCH 3/3] lint fix --- tests/actions/IOUTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 11fb22db01b6..c43837fbfd34 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -1742,7 +1742,7 @@ describe('actions/IOU', () => { }), ]), originalMessage: expect.objectContaining({ - amount: amount, + amount, paymentType: CONST.IOU.PAYMENT_TYPE.VBBA, type: 'pay', }),