Skip to content
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

Added a support for REIMBURSED action #54102

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,11 @@ function getReportActionMessageFragments(action: ReportAction): Message[] {
return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
}

if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
const message = getReportActionMessageText(action);
return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
}

const actionMessage = action.previousMessage ?? action.message;
if (Array.isArray(actionMessage)) {
return actionMessage.filter((item): item is Message => !!item);
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
40 changes: 40 additions & 0 deletions tests/unit/ReportActionsUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: `<muted-text>${expectedMessage}</muted-text>`, type: 'COMMENT'}]);
});
});
});
Loading