Repository navigation
[Due for payment 2025-11-03] [Due for payment 2025-10-27] [Due for payment 2025-10-22] [Due for payment 2025-10-06] [$250] Chat - Message sent is not shown correctly in LHN #60746
Description
Activity
- addedBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2
on Apr 23, 2025 Triggered auto assignment to @abekkala (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.Proposal
Please re-state the problem that we are trying to solve in this issue.
Message is not shown correctly on the LHN.
What is the root cause of that problem?
When we send an HTML to a chat, it will be converted to text.
{Parser.htmlToText(optionItem.alternateText)} Line 643 in e1e89c9
result.alternateText = formatReportLastMessageText(Parser.htmlToText(`${lastActorDisplayName}: ${lastMessageText}`));
App/src/libs/OptionsListUtils.ts
Line 599 in e1e89c9
const formattedLastMessageText = formatReportLastMessageText(Parser.htmlToText(option.lastMessageText ?? '')); It was all added because of a BE bug where the
lastMessageTextcontains HTML, even though it should only contain plain text. So to fix it, we patch it on the FE by converting thelastMessageTextto text. But because of this, if the user sends HTML as a plain text, the LHN won't be able to show it.What changes do you think we should make in order to solve the problem?
This is actually the same issue as #43563, and I suggest to removes the FE patch and properly fix it on the BE.
If we can't fix the BE, still remove the patch, but instead of returning the
lastMessageText, we can parse thelastMessageHtmlto text.
App/src/libs/OptionsListUtils.ts
Line 807 in e1e89c9
return lastMessageTextFromReport || (report?.lastMessageText ?? ''); Parser.htmlToText(lastMessageHtml)This is at least semantically(?) correct, convert HTML to text. Previously, we converted a text that could contain HTML to text.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
I think we can test
getLastMessageTextForReport, give it a dummy DM report withlastMessageHtmland assert the results is the converted HTML to text.- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
on Apr 25, 2025 - changed the title
[-]Chat - Message sent is not shown correctly in LHN[/-][+][$250] Chat - Message sent is not shown correctly in LHN[/+]on Apr 25, 2025 Job added to Upwork: https://www.upwork.com/jobs/~021915821361423926706
- addedHelp WantedApply this label when an issue is open to proposals by contributorsApply this label when an issue is open to proposals by contributors
on Apr 25, 2025 Triggered auto assignment to Contributor-plus team member for initial proposal review - @QichenZhu (
External)@QichenZhu Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@bernhardoj thanks for the proposal.
About the first solution (fixing this in both FE and BE):
- Can the BE tell whether the HTML was intentionally input by the user or generated from Markdown?
- In addition to the BE issue mentioned in your proposal, when the user inputs
<, shouldlastMessageTextbe<or<? It currently returns<:

125 remaining items
PAYMENT SUMMARY FOR OCT 27
- Fix: @bernhardoj [$250, if no regressions] payment via NewDot
- PR Review @QichenZhu [$250, if no regressions] payment via Upwork - OFFER
please complete checklist
BugZero Checklist:
-
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: No offending PR in this repo.
-
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A.
-
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
-
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/561655
Regression Test Proposal
Test:
- Open any chat
- Send a message with HTML tag (for example,
<div>test</div>) - Verify in LHN, the last message text shows the whole text
Additional tests:
A. Moved expense to self DM
- Create an expense in WS chat
- Open the expense and select the Report field
- Select Remove from report
- Open the expense in the self DM
- Verify the LHN's last message for the expense report has no HTML tag
B. Failed to integrate accounting
- Enable accounting in WS
- Connect to anything that will fail
- Open the admins room
- Find the message that says the integration failed (it is sometimes inside a thread)
- Verify the report where the message appears. The LHN's last message has no HTML tag
C. Move IOU report to workspace
- User A has a workspace and invites User B
- User B sends a money request to User A
- User A opens the report
- User A changes the workspace to workspace in step 1
- Verify the report LHN's last message has no HTML
D. Move expense to another report
- Create an expense in a WS chat
- Create a new empty report
- Open the expense report in step 1
- Press the Report field and change to the empty report
- Now open the expense report from step 2
- Verify the report LHN's last message has no HTML
E. Submit expense with markdown description
- Open a DM chat
- Submit an expense with a description that contains markdown
- Verify the DM last message doesn't show HTML tag
F. Submit expense with multiline description
- Create a money request with multiline description in a DM
- Press the search icon on the top right
- Verify the expense report last message shows in 1 line
Do we agree 👍 or 👎
Reacted by April Bekkala-
PAYMENT SUMMARY FOR OCT 27
- Fix: @bernhardoj [$250] payment via NewDot
- PR Review @QichenZhu [$250] payment sent via Upwork and contract ended!
Thanks! 🎉
Reacted by Qichen ZhuRequested in ND.
- changed the title
[-][Due for payment 2025-10-27] [Due for payment 2025-10-22] [Due for payment 2025-10-06] [$250] Chat - Message sent is not shown correctly in LHN[/-][+][Due for payment 2025-11-03] [Due for payment 2025-10-27] [Due for payment 2025-10-22] [Due for payment 2025-10-06] [$250] Chat - Message sent is not shown correctly in LHN[/+]on Oct 27, 2025 Reviewinglabel has been removed, please complete the "BugZero Checklist".The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.38-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-11-03. 🎊
For reference, here are some details about the assignees on this issue:
- @s77rt does not require payment (Contractor)
- @bernhardoj requires payment through NewDot Manual Requests
- @QichenZhu requires payment automatic offer (Reviewer)
@bernhardoj / @QichenZhu @abekkala The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
$250 approved to @bernhardoj
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9 1.32-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): Slottwo1555d@gmail.com
Issue reported by: Applause - Internal Team
Action Performed:
© <div>test</div>
© <div>test</div>
©
Expected Result:
LHN should show exactly the message sent (
© <div>test</div>)
Actual Result:
On sending this message (© <div>test</div>)- LHN is not showing the entire text as it is , it displays © test & if same message sent from settings via opened workspace chat, displays ©
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Platforms Tested:
On which of our officially supported platforms was this issue tested:Screenshots/Videos
Add any screenshot/video evidence
Bug6811030_1745441402894.Screenrecorder-2025-04-24-02-05-36-493.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @abekkala