Skip to content

Commit 0777dbe

Browse files
committed
implemented HTML parsing for getReportNames() solving regression bug from issue 74713
1 parent 504a06b commit 0777dbe

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/libs/ReportUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5581,7 +5581,7 @@ function getReportName(
55815581
}
55825582

55835583
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION)) {
5584-
return getUnreportedTransactionMessage();
5584+
return Parser.htmlToText(getUnreportedTransactionMessage());
55855585
}
55865586

55875587
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MAX_EXPENSE_AMOUNT_NO_RECEIPT)) {

tests/unit/ReportUtilsTest.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,33 @@ describe('ReportUtils', () => {
10861086
);
10871087
});
10881088
});
1089+
1090+
describe('Unreported transaction thread', () => {
1091+
test('HTML is stripped from unreported transaction message', () => {
1092+
const transactionThread = {
1093+
...LHNTestUtils.getFakeReport(),
1094+
type: CONST.REPORT.TYPE.CHAT,
1095+
reportID: '123',
1096+
parentReportID: '456',
1097+
};
1098+
1099+
const unreportedTransactionAction = {
1100+
actionName: CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
1101+
originalMessage: {
1102+
fromReportID: '789',
1103+
},
1104+
} as ReportAction;
1105+
1106+
const reportName = getReportName(transactionThread, undefined, unreportedTransactionAction);
1107+
1108+
// Should NOT contain HTML tags
1109+
expect(reportName).not.toContain('<a href');
1110+
expect(reportName).not.toContain('</a>');
1111+
// Should contain the text content
1112+
expect(reportName).toContain('moved this expense');
1113+
expect(reportName).toContain('personal space');
1114+
});
1115+
});
10891116
});
10901117

10911118
// Need to merge the same tests

0 commit comments

Comments
 (0)