Decode HTML entities in report names for search rows and report preview#96383
Decode HTML entities in report names for search rows and report preview#96383MelvinBot wants to merge 1 commit into
Conversation
Co-authored-by: daledah <daledah@users.noreply.github.com>
|
I looked into the failing checks — there's no code fix needed. The only failing check is PR Author Checklist /
That check clears once the human co-author ( Every other check passes: Next step: complete the PR Author Checklist and fill in the |
Explanation of Change
Report names are stored HTML-entity-encoded (e.g.
Bob & Co), and the app's convention is to decode them for plain-text display withParser.htmlToText. Three surfaces skipped that step and rendered the raw encoded string:ExpenseReportListItemRowWide/ExpenseReportListItemRowNarrow), becausegetReportSectionsinSearchUIUtils.tsspread the raw report (...reportItem) and never decodedreportName— unlike the sibling task path, which already does.ReportPreviewHeader, whose name comes from the derived report attribute (raw for expense reports) with a rawaction.childReportNamefallback.This PR mirrors the established pattern (accepted proposal):
getReportSections, decodereportNamewithStringUtils.lineBreaksToSpaces(Parser.htmlToText(...))right after the existing IOU-name override, matching the task path. One line fixes the wide row, the narrow row's visible title, its screen-readeraccessibilityLabel, and TITLE-column sorting, since all read the sameitem.reportName. Placing it after the IOU override is a no-op for the already-plain IOU string.ReportPreviewHeader, decode the resolved name (reportName || action.childReportName) withParser.htmlToText, memoized to match the component's existinguseMemopattern for its other derived values.A central decode inside
computeReportName/getReportNamewas intentionally avoided:getMovedTransactionMessage/getUnreportedTransactionMessagealready wrap that value inParser.htmlToText, so decoding upstream would double-decode them.Automated checks run by the author (not manual QA):
npm run typecheck-tsgo,npm run lint-changed,npm run react-compiler-compliance-check checkon the modified component, and the relevant Jest suites (tests/unit/Search/SearchUIUtilsTest.ts,tests/ui/MoneyRequestReportPreview.test.tsx) — all passing. A unit test asserting the decode was added toSearchUIUtilsTest.ts. The fullnpm testsuite and Storybook smoke test were not run in this environment and should be validated by CI.Fixed Issues
$ #95808
PROPOSAL: #95808 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review". Please describe what tests you performed that validate your change worked.
Offline tests
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review". Please describe what QA needs to do to validate your changes and what areas they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari