diff --git a/src/CONST.ts b/src/CONST.ts index 4fcc1cada6ff..e7d9411b619c 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1051,6 +1051,7 @@ const CONST = { MODIFIED_EXPENSE: 'MODIFIEDEXPENSE', MOVED: 'MOVED', OUTDATED_BANK_ACCOUNT: 'OUTDATEDBANKACCOUNT', // OldDot Action + REIMBURSED: 'REIMBURSED', REIMBURSEMENT_ACH_BOUNCE: 'REIMBURSEMENTACHBOUNCE', // OldDot Action REIMBURSEMENT_ACH_CANCELLED: 'REIMBURSEMENTACHCANCELLED', // OldDot Action REIMBURSEMENT_ACCOUNT_CHANGED: 'REIMBURSEMENTACCOUNTCHANGED', // OldDot Action diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 1e360855c5f3..dd17adbda338 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1403,6 +1403,11 @@ function getReportActionMessageFragments(action: ReportAction): Message[] { return [{text: message, html: `${message}`, type: 'COMMENT'}]; } + if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) { + const message = getReportActionMessageText(action); + return [{text: message, html: `${message}`, type: 'COMMENT'}]; + } + const actionMessage = action.previousMessage ?? action.message; if (Array.isArray(actionMessage)) { return actionMessage.filter((item): item is Message => !!item); diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index fd94531abb0f..0cb9a735aad4 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -598,6 +598,7 @@ type OriginalMessageMap = { [CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE]: OriginalMessageModifiedExpense; [CONST.REPORT.ACTIONS.TYPE.MOVED]: OriginalMessageMoved; [CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT]: never; + [CONST.REPORT.ACTIONS.TYPE.REIMBURSED]: never; [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE]: never; [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED]: never; [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED]: never; diff --git a/tests/unit/ReportActionsUtilsTest.ts b/tests/unit/ReportActionsUtilsTest.ts index b94740375261..c14753d15920 100644 --- a/tests/unit/ReportActionsUtilsTest.ts +++ b/tests/unit/ReportActionsUtilsTest.ts @@ -596,4 +596,44 @@ describe('ReportActionsUtils', () => { ); }); }); + + describe('getReportActionMessageFragments', () => { + it('should return the correct fragment for the REIMBURSED action', () => { + const action = { + actionName: CONST.REPORT.ACTIONS.TYPE.REIMBURSED, + reportActionID: '1', + created: '1', + message: [ + { + type: 'TEXT', + style: 'strong', + text: 'Concierge', + }, + { + type: 'TEXT', + style: 'normal', + text: ' reimbursed this report', + }, + { + type: 'TEXT', + style: 'normal', + text: ' on behalf of you', + }, + { + type: 'TEXT', + style: 'normal', + text: ' from the bank account ending in 1111', + }, + { + type: 'TEXT', + style: 'normal', + text: '. Money is on its way to your bank account ending in 0000. Reimbursement estimated to complete on Dec 16.', + }, + ], + }; + const expectedMessage = ReportActionsUtils.getReportActionMessageText(action); + const expectedFragments = ReportActionsUtils.getReportActionMessageFragments(action); + expect(expectedFragments).toEqual([{text: expectedMessage, html: `${expectedMessage}`, type: 'COMMENT'}]); + }); + }); });