From 352a16e1ada48191173853ad57f2278e83c90624 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Fri, 3 Apr 2026 22:48:36 +0530 Subject: [PATCH 1/6] Use dynamic message from server --- src/libs/OptionsListUtils/index.ts | 2 +- src/libs/ReportUtils.ts | 2 +- src/pages/inbox/report/PureReportActionItem.tsx | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/OptionsListUtils/index.ts b/src/libs/OptionsListUtils/index.ts index 3840f2d8337e..d57d20dcafff 100644 --- a/src/libs/OptionsListUtils/index.ts +++ b/src/libs/OptionsListUtils/index.ts @@ -818,7 +818,7 @@ function getLastMessageTextForReport({ } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION) { lastMessageTextFromReport = getExportIntegrationLastMessageText(translate, lastReportAction); } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED) { - lastMessageTextFromReport = translate('iou.receiptScanningFailed'); + lastMessageTextFromReport = getReportActionMessageText(lastReportAction) ?? translate('iou.receiptScanningFailed'); } else if (lastReportAction?.actionName && isOldDotReportAction(lastReportAction)) { lastMessageTextFromReport = getMessageOfOldDotReportAction(translate, lastReportAction, false); } else if (isActionableJoinRequest(lastReportAction)) { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 028063d4cfd1..7367cb080dc1 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5841,7 +5841,7 @@ function getReportActionMessage({ }); } if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED) { - return translate('iou.receiptScanningFailed'); + return getReportActionMessageText(reportAction) ?? translate('iou.receiptScanningFailed'); } if (isReimbursementDeQueuedOrCanceledAction(reportAction)) { diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 1257050fb9cc..17f6991a1b9e 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -1704,7 +1704,8 @@ function PureReportActionItem({ } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED)) { - children = ; + const htmlMessage = getReportActionMessageText(action) ?? translate('iou.receiptScanningFailed'); + children = ; } else if (isRenamedAction(action)) { const message = getRenamedAction(translate, action, isExpenseReport(report)); children = ; From 15d5caaa842e8f1aa57acf5eb3d836c8ef07933c Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Fri, 3 Apr 2026 23:51:34 +0530 Subject: [PATCH 2/6] Add import --- src/pages/inbox/report/PureReportActionItem.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 17f6991a1b9e..61b79e1bcd2d 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -125,6 +125,7 @@ import { getRenamedCardFeedMessage, getReportActionHtml, getReportActionMessage, + getReportActionMessageText, getReportActionText, getSetAutoJoinMessage, getSettlementAccountLockedMessage, From 3afbdb8ee2779ee09df091b3e2066eb72ac465cf Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 14 Apr 2026 12:37:23 +0530 Subject: [PATCH 3/6] Use coalescing operator --- src/libs/OptionsListUtils/index.ts | 2 +- src/pages/inbox/report/PureReportActionItem.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils/index.ts b/src/libs/OptionsListUtils/index.ts index 8936ca8a1bc8..f38d60c36810 100644 --- a/src/libs/OptionsListUtils/index.ts +++ b/src/libs/OptionsListUtils/index.ts @@ -821,7 +821,7 @@ function getLastMessageTextForReport({ } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION) { lastMessageTextFromReport = getExportIntegrationLastMessageText(translate, lastReportAction); } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED) { - lastMessageTextFromReport = getReportActionMessageText(lastReportAction) ?? translate('iou.receiptScanningFailed'); + lastMessageTextFromReport = getReportActionMessageText(lastReportAction) || translate('iou.receiptScanningFailed'); } else if (lastReportAction?.actionName && isOldDotReportAction(lastReportAction)) { lastMessageTextFromReport = getMessageOfOldDotReportAction(translate, lastReportAction, false); } else if (isActionableJoinRequest(lastReportAction)) { diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 5ae22e9e3971..a489d76cfc1c 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -1716,7 +1716,7 @@ function PureReportActionItem({ } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED)) { - const htmlMessage = getReportActionMessageText(action) ?? translate('iou.receiptScanningFailed'); + const htmlMessage = getReportActionMessageText(action) || translate('iou.receiptScanningFailed'); children = ; } else if (isRenamedAction(action)) { const message = getRenamedAction(translate, action, isExpenseReport(report)); From 415eb90936611f3d22dacbdb4a59bea94099eef6 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 14 Apr 2026 17:57:27 +0530 Subject: [PATCH 4/6] Fix tests --- tests/ui/PureReportActionItemTest.tsx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index 0d488e056e51..510de94cfb8f 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -804,11 +804,6 @@ describe('PureReportActionItem', () => { actionName: CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES, translationKey: 'violations.resolvedDuplicates' as TranslationPaths, }, - { - testTitle: 'RECEIPT_SCAN_FAILED action', - actionName: CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED, - translationKey: 'iou.receiptScanningFailed' as TranslationPaths, - }, { testTitle: 'UNAPPROVED action', actionName: CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, @@ -834,6 +829,23 @@ describe('PureReportActionItem', () => { expect(screen.getByText(translateLocal(translationKey))).toBeOnTheScreen(); }); + it('RECEIPT_SCAN_FAILED action shows message from action data', async () => { + // Given a RECEIPT_SCAN_FAILED message with a html message from server. + // Then verify server message is rendered. + const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED, {}); + action.message = [{type: 'COMMENT', html: "the date couldn't be read from this receipt. Please enter it manually.", text: "the date couldn't be read from this receipt. Please enter it manually."}]; + renderItemWithAction(action); + await waitForBatchedUpdatesWithAct(); + expect(screen.getByText("the date couldn't be read from this receipt. Please enter it manually.")).toBeOnTheScreen(); + + // Given an RECEIPT_SCAN_FAILED with no server side message + // Then verify generic translation phrase is rendered + action.message = [{type: 'COMMENT', html: "", text: ""}]; + renderItemWithAction(action); + await waitForBatchedUpdatesWithAct(); + expect(screen.getByText(translateLocal('iou.receiptScanningFailed'))).toBeOnTheScreen(); + }); + it('HOLD_COMMENT action renders via ReportActionItemBasicMessage', async () => { const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT, {}); action.message = [{type: 'COMMENT', html: 'Hold reason text', text: 'Hold reason text'}]; From 831631d38f3a4c015d8e866d8f66fd2249184abf Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 14 Apr 2026 18:13:10 +0530 Subject: [PATCH 5/6] Run prettier --- tests/ui/PureReportActionItemTest.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index c6ff77012108..ea89a72315cf 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -957,14 +957,20 @@ describe('PureReportActionItem', () => { // Given a RECEIPT_SCAN_FAILED message with a html message from server. // Then verify server message is rendered. const action = createReportAction(CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED, {}); - action.message = [{type: 'COMMENT', html: "the date couldn't be read from this receipt. Please enter it manually.", text: "the date couldn't be read from this receipt. Please enter it manually."}]; + action.message = [ + { + type: 'COMMENT', + html: "the date couldn't be read from this receipt. Please enter it manually.", + text: "the date couldn't be read from this receipt. Please enter it manually.", + }, + ]; renderItemWithAction(action); await waitForBatchedUpdatesWithAct(); expect(screen.getByText("the date couldn't be read from this receipt. Please enter it manually.")).toBeOnTheScreen(); // Given an RECEIPT_SCAN_FAILED with no server side message // Then verify generic translation phrase is rendered - action.message = [{type: 'COMMENT', html: "", text: ""}]; + action.message = [{type: 'COMMENT', html: '', text: ''}]; renderItemWithAction(action); await waitForBatchedUpdatesWithAct(); expect(screen.getByText(translateLocal('iou.receiptScanningFailed'))).toBeOnTheScreen(); From ac6271735e60af194243345310c4ece68f43998e Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 14 Apr 2026 20:10:14 +0530 Subject: [PATCH 6/6] Fix lint --- src/pages/inbox/report/PureReportActionItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 2790add6d49b..e8053e8e6dd2 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -122,7 +122,6 @@ import { getRenamedCardFeedMessage, getReportActionHtml, getReportActionMessage, - getReportActionMessageText, getReportActionText, getSetAutoJoinMessage, getSettlementAccountLockedMessage,