Skip to content
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
4 changes: 3 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,9 @@
"Synovus",
"Wallester",
"Wintrust",
"Zürcher"
"Zürcher",
"CARDFROZEN",
"CARDUNFROZEN"
],
"ignorePaths": [
"src/languages/de.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,8 @@ const CONST = {
CARD_REPLACED_VIRTUAL: 'CARDREPLACEDVIRTUAL',
CARD_REPLACED: 'CARDREPLACED',
CARD_ASSIGNED: 'CARDASSIGNED',
CARD_FROZEN: 'CARDFROZEN',
CARD_UNFROZEN: 'CARDUNFROZEN',
PERSONAL_CARD_CONNECTION_BROKEN: 'PERSONALCARDCONNECTIONBROKEN',
CHANGE_FIELD: 'CHANGEFIELD', // OldDot Action
CHANGE_POLICY: 'CHANGEPOLICY',
Expand Down
7 changes: 7 additions & 0 deletions src/pages/inbox/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ import {
getRemovedFromApprovalChainMessage,
getRenamedAction,
getRenamedCardFeedMessage,
getReportActionHtml,
getReportActionMessage,
getReportActionText,
getSetAutoJoinMessage,
Expand Down Expand Up @@ -1523,6 +1524,12 @@ function PureReportActionItem({
children = <UnreportedTransactionAction action={action as OnyxTypes.ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION>} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MERGED_WITH_CASH_TRANSACTION) {
children = <ReportActionItemBasicMessage message={translate('systemMessage.mergedWithCashTransaction')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN || action.actionName === CONST.REPORT.ACTIONS.TYPE.CARD_UNFROZEN) {
children = (
<ReportActionItemBasicMessage message="">
<RenderHTML html={`<comment><muted-text>${getReportActionHtml(action)}</muted-text></comment>`} />

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Render fallback text for empty card freeze message arrays

This branch renders card freeze/unfreeze actions from getReportActionHtml(action), but that helper only reads the first entry of action.message; when the backend sends these actions with message: [] and only originalMessage.html (the scenario covered by the new tests), this produces an empty <muted-text> block so the visible system message is blank. In practice, users will see an empty action row instead of the freeze/unfreeze notice unless the message array is populated.

Useful? React with 👍 / 👎.

</ReportActionItemBasicMessage>
);
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION)) {
children = <ReportActionItemBasicMessage message={getDismissedViolationMessageText(translate, getOriginalMessage(action))} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES)) {
Expand Down
18 changes: 17 additions & 1 deletion src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,20 @@ type OriginalMessageCard = {
hadMissingAddress?: boolean;
};

/**
* Model of CARDFROZEN action
*/
type OriginalMessageCardFrozen = {
/** HTML content of the system message */
html: string;

/** Whether the action was generated by NewDot */
isNewDot?: boolean;

/** When the action was last modified */
lastModified?: string;
};

/**
* Model of PERSONAL_CARD_CONNECTION_BROKEN action
*/
Expand Down Expand Up @@ -1352,7 +1366,7 @@ type OriginalMessageSettlementAccountLocked = {
};

/**
* Original message for CARD_ISSUED, CARD_MISSING_ADDRESS, CARD_ASSIGNED, CARD_ISSUED_VIRTUAL and CARD_ISSUED_VIRTUAL actions
* Original message for Expensify Card issue/replacement actions
*/
type IssueNewCardOriginalMessage = OriginalMessage<
| typeof CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS
Expand Down Expand Up @@ -1469,6 +1483,8 @@ type OriginalMessageMap = {
[CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED_VIRTUAL]: OriginalMessageCard;
[CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED]: OriginalMessageCard;
[CONST.REPORT.ACTIONS.TYPE.CARD_ASSIGNED]: OriginalMessageCard;
[CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN]: OriginalMessageCardFrozen;
[CONST.REPORT.ACTIONS.TYPE.CARD_UNFROZEN]: OriginalMessageCardFrozen;
[CONST.REPORT.ACTIONS.TYPE.PERSONAL_CARD_CONNECTION_BROKEN]: OriginalPersonalCard;
[CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED]: OriginalMessageIntegrationSyncFailed;
[CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION]: OriginalMessageDeletedTransaction;
Expand Down
128 changes: 127 additions & 1 deletion tests/unit/ReportActionsUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,109 @@ describe('ReportActionsUtils', () => {
const expectedHtml = `<muted-text>${expectedText}</muted-text>`;
expect(fragments).toEqual([{text: expectedText, html: expectedHtml, type: 'COMMENT'}]);
});

it('should preserve backend-provided CARDFROZEN fragments', () => {
const cardFrozenMessage = 'A A froze their Expensify Card (ending in 1384). New transactions will be declined until the card is unfrozen.';
const action: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN> = {
actionName: CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN,
reportActionID: 'card-frozen-action-123',
actorAccountID: 21052128,
created: '2026-03-12 01:58:43.479',
message: [
{
html: cardFrozenMessage,
text: cardFrozenMessage,
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
whisperedTo: [],
},
],
originalMessage: {
html: cardFrozenMessage,
isNewDot: true,
lastModified: '2026-03-12 01:58:43.479',
},
};

expect(ReportActionsUtils.getReportActionMessageFragments(translateLocal, action)).toEqual(action.message);
});

it('should preserve backend-provided CARDUNFROZEN fragments', () => {
const cardUnfrozenMessage = 'A A unfroze their Expensify Card (ending in 1384). This card can now be used for transactions.';
const action: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CARD_UNFROZEN> = {
actionName: CONST.REPORT.ACTIONS.TYPE.CARD_UNFROZEN,
reportActionID: 'card-unfrozen-action-123',
actorAccountID: 21052128,
created: '2026-03-12 02:08:08.128',
message: [
{
html: cardUnfrozenMessage,
text: cardUnfrozenMessage,
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
whisperedTo: [],
},
],
originalMessage: {
html: cardUnfrozenMessage,
isNewDot: true,
lastModified: '2026-03-12 02:08:08.128',
},
};

expect(ReportActionsUtils.getReportActionMessageFragments(translateLocal, action)).toEqual(action.message);
});
});

describe('getReportActionText', () => {
it('should return the backend-provided CARDFROZEN text', () => {
const cardFrozenMessage = 'A A froze their Expensify Card (ending in 1384). New transactions will be declined until the card is unfrozen.';
const action: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN> = {
actionName: CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN,
reportActionID: 'card-frozen-action-123',
actorAccountID: 21052128,
created: '2026-03-12 01:58:43.479',
message: [
{
html: cardFrozenMessage,
text: cardFrozenMessage,
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
whisperedTo: [],
},
],
originalMessage: {
html: cardFrozenMessage,
isNewDot: true,
lastModified: '2026-03-12 01:58:43.479',
},
};

expect(ReportActionsUtils.getReportActionText(action)).toBe(cardFrozenMessage);
});

it('should return the backend-provided CARDUNFROZEN text', () => {
const cardUnfrozenMessage = 'A A unfroze their Expensify Card (ending in 1384). This card can now be used for transactions.';
const action: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CARD_UNFROZEN> = {
actionName: CONST.REPORT.ACTIONS.TYPE.CARD_UNFROZEN,
reportActionID: 'card-unfrozen-action-123',
actorAccountID: 21052128,
created: '2026-03-12 02:08:08.128',
message: [
{
html: cardUnfrozenMessage,
text: cardUnfrozenMessage,
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
whisperedTo: [],
},
],
originalMessage: {
html: cardUnfrozenMessage,
isNewDot: true,
lastModified: '2026-03-12 02:08:08.128',
},
};

expect(ReportActionsUtils.getReportActionText(action)).toBe(cardUnfrozenMessage);
expect(ReportActionsUtils.shouldReportActionBeVisible(action, action.reportActionID, true)).toBe(true);
});
});

describe('getMessageOfOldDotReportAction', () => {
Expand Down Expand Up @@ -1665,6 +1768,30 @@ describe('ReportActionsUtils', () => {
const reportAction = buildOptimisticCreatedReportForUnapprovedAction('123456', '789012');
expect(ReportActionsUtils.isDeletedAction(reportAction)).toBe(false);
});

it('should return false for CARDFROZEN action with a backend-provided message fragment', () => {
const reportAction: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN> = {
actionName: CONST.REPORT.ACTIONS.TYPE.CARD_FROZEN,
reportActionID: 'card-frozen-action-123',
actorAccountID: 21052128,
created: '2026-03-12 01:58:43.479',
message: [
{
html: 'A A froze their Expensify Card (ending in 1384). New transactions will be declined until the card is unfrozen.',
text: 'A A froze their Expensify Card (ending in 1384). New transactions will be declined until the card is unfrozen.',
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
whisperedTo: [],
},
],
originalMessage: {
html: 'A A froze their Expensify Card (ending in 1384). New transactions will be declined until the card is unfrozen.',
isNewDot: true,
lastModified: '2026-03-12 01:58:43.479',
},
};

expect(ReportActionsUtils.isDeletedAction(reportAction)).toBe(false);
});
});

describe('getRenamedAction', () => {
Expand Down Expand Up @@ -1728,7 +1855,6 @@ describe('ReportActionsUtils', () => {
} as Card;

const testPolicyID = 'test-policy-123';

describe('render virtual card issued messages', () => {
it('should render a plain text message without card link when no card data is available', () => {
const messageResult = getCardIssuedMessage({
Expand Down
Loading