Skip to content

Commit eb05c5c

Browse files
committed
implemented HTML parsing for getReportNames() solving regression bug from issue 74713
1 parent 2a93b41 commit eb05c5c

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
@@ -5598,7 +5598,7 @@ function getReportName(
55985598
}
55995599

56005600
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION)) {
5601-
return getUnreportedTransactionMessage();
5601+
return Parser.htmlToText(getUnreportedTransactionMessage());
56025602
}
56035603

56045604
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
@@ -1114,6 +1114,33 @@ describe('ReportUtils', () => {
11141114
);
11151115
});
11161116
});
1117+
1118+
describe('Unreported transaction thread', () => {
1119+
test('HTML is stripped from unreported transaction message', () => {
1120+
const transactionThread = {
1121+
...LHNTestUtils.getFakeReport(),
1122+
type: CONST.REPORT.TYPE.CHAT,
1123+
reportID: '123',
1124+
parentReportID: '456',
1125+
};
1126+
1127+
const unreportedTransactionAction = {
1128+
actionName: CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
1129+
originalMessage: {
1130+
fromReportID: '789',
1131+
},
1132+
} as ReportAction;
1133+
1134+
const reportName = getReportName(transactionThread, undefined, unreportedTransactionAction);
1135+
1136+
// Should NOT contain HTML tags
1137+
expect(reportName).not.toContain('<a href');
1138+
expect(reportName).not.toContain('</a>');
1139+
// Should contain the text content
1140+
expect(reportName).toContain('moved this expense');
1141+
expect(reportName).toContain('personal space');
1142+
});
1143+
});
11171144
});
11181145

11191146
// Need to merge the same tests

0 commit comments

Comments
 (0)