diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 9121eebb3367..3f8176a3f6f5 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1,4 +1,5 @@ /* eslint-disable no-continue */ +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import Str from 'expensify-common/lib/str'; // eslint-disable-next-line you-dont-need-lodash-underscore/get import lodashGet from 'lodash/get'; @@ -585,8 +586,13 @@ function getLastMessageTextForReport(report: OnyxEntry, lastActorDetails } else if (ReportActionUtils.isCreatedTaskReportAction(lastReportAction)) { lastMessageTextFromReport = TaskUtils.getTaskCreatedMessage(lastReportAction); } - - return lastMessageTextFromReport || (report?.lastMessageText ?? ''); + const parser = new ExpensiMark(); + return ( + lastMessageTextFromReport || + (lastActionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT + ? ReportUtils.formatReportLastMessageText(parser.htmlToText(report?.lastMessageHtml ?? ''), false, true) + : report?.lastMessageText ?? '') + ); } /** diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index ea0eba523092..92283e95aa81 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1377,10 +1377,16 @@ function canShowReportRecipientLocalTime(personalDetails: OnyxCollection = { lastVisibleActionCreated: currentTime, lastMessageTranslationKey: lastComment?.translationKey ?? '', - lastMessageText: lastCommentText, - lastMessageHtml: lastCommentText, + lastMessageText: text, + lastMessageHtml: text, lastActorAccountID: currentUserAccountID, lastReadTime: currentTime, };