Fix ExpensiMark formatting display in MODIFIEDEXPENSE messages#82057
Fix ExpensiMark formatting display in MODIFIEDEXPENSE messages#82057
Conversation
Change ModifiedExpenseMessage to use Parser.htmlToText() instead of Parser.htmlToMarkdown() when displaying oldComment/newComment values. Problem: When descriptions contained HTML formatting like <del>Test</del>, the code converted it to ExpensiMark markdown (~Test~) but then displayed that markdown literally as text instead of rendering it. Users saw: "changed the description to \"~Test~\"" with literal tildes. Solution: Use Parser.htmlToText() which strips HTML tags to plain text. Now displays: "changed the description to \"Test\"" cleanly without formatting markers. This matches how other fields (merchant, category) are displayed in MODIFIEDEXPENSE messages - as plain text values in quotes. Note: The actual description value is still stored with HTML formatting in the backend and renders correctly when viewing the transaction. This only affects the system message display. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The ReportActionItemMessageWithExplain component uses RenderHTML to render the modifiedExpenseMessage, which means it can properly display HTML tags. Previously we were stripping HTML to plain text with Parser.htmlToText(), which removed all formatting. Before that, we were converting to markdown with Parser.htmlToMarkdown(), which showed literal markdown markers. The correct approach is to pass the HTML through unchanged, allowing RenderHTML to render formatting tags like <del>, <strong>, <em> properly. Now messages like "changed the description to \"<del>Strikethrough</del>\"" will render with actual strikethrough formatting instead of showing as plain text or literal markers. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e64b2a83d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fixed issue where passing raw HTML through getForReportAction() was breaking plain-text consumers that now received literal HTML tags instead of readable text. Updated the following plain-text consumers to strip HTML using Parser.htmlToText(): - BrowserNotifications: For notification bodies - ReportNameUtils: For report preview text - ReportUtils: For formatReportLastMessageText - OptionsListUtils: For options list display - ContextMenuActions: For clipboard copy The ReportActionItem component (which uses RenderHTML) continues to receive HTML for proper formatting display. Fixes review feedback from #82057 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
The changes are simple and defensive, just adding Parser.htmlToText() calls. The decrease in coverage is acceptable, IMO. |
|
This PR is held on Expensify/Auth#19674 |
heyjennahay
left a comment
There was a problem hiding this comment.
Bug fix. Product review not required
|
Merged main to fix a conflict. This is ready for review @MariaHCD |
|
If this requires C+ review, I can help |
|
Assigning @situchan for C+ review. |
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
| import {formatList, translateLocal} from './Localize'; | ||
| import Log from './Log'; | ||
| import Parser from './Parser'; |
There was a problem hiding this comment.
This is still used here:
App/src/libs/ModifiedExpenseMessage.ts
Line 256 in bbb6cbd
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safariweb1.movweb2.movweb3.mov |
|
@situchan Updated to add back |
|
Please fix conflict |
…StrikethroughDisplayModifiedExpense
|
Merge conflict resolved! |
|
I think we should also strip markdown here: App/src/libs/ModifiedExpenseMessage.ts Lines 255 to 256 in e1b02aa
After strip:
|
|
@deetergp please check above comments |
|
Sorry @situchan, was OOO the first part of the week. I have updated to allow for copying markdown from the context menu. |
|
@srikarparsi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Maria is OOO. @deetergp I think we can merge |
|
🚧 @deetergp has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/deetergp in version: 9.3.41-0 🚀
Bundle Size Analysis (Sentry): |
|
This PR failing because of the issue #85904 |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.41-4 🚀
|


Explanation of Change
Fixes MODIFIEDEXPENSE system messages to properly render formatting (bold, italic, strikethrough) instead of showing as plain text or literal markdown markers.
When Concierge AI sets expense descriptions with ExpensiMark formatting (e.g.,
~strikethrough~,*bold*,_italic_), the backend correctly stores them as HTML (<del>,<strong>,<em>). However, MODIFIEDEXPENSE system messages like "changed the description to X" were not rendering the formatting correctly.Root Cause: The
modifiedExpenseMessageis rendered byReportActionItemMessageWithExplain, which uses theRenderHTMLcomponent. This component can properly render HTML tags, but we were converting the HTML before passing it in:Parser.htmlToMarkdown()converted HTML to markdown syntax, showing literal markers (~text~)Parser.htmlToText()stripped all HTML, showing plain textSolution: Pass the HTML through unchanged in
ModifiedExpenseMessage.ts. TheRenderHTMLcomponent will properly render formatting tags like<del>,<strong>,<em>as visual formatting.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/595061
PROPOSAL: N/A
Tests
Test"StrikeBold Italic" - verify all formatting rendersOffline tests
N/A - This change only affects visual rendering of existing data, no network requests involved
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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