From 751e9a705b4eb684669afa4f3d38839551c3b49e Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 10 Apr 2024 16:08:12 +0700 Subject: [PATCH 1/4] fix thread shows expensify.sms in header --- src/libs/ReportUtils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 85f5c414dbe4..d22ac77bcb09 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2871,10 +2871,16 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu } const isAttachment = ReportActionsUtils.isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : null); + const parser = new ExpensiMark(); const parentReportActionMessage = ( ReportActionsUtils.isApprovedOrSubmittedReportAction(parentReportAction) ? ReportActionsUtils.getReportActionMessageText(parentReportAction) - : parentReportAction?.message?.[0]?.text ?? '' + : parser.htmlToText( + (parentReportAction?.message?.[0]?.html ?? '').replace(/()(.*?)(<\/mention-user>)/gi, function (match, openTag, content, closeTag) { + content = Str.removeSMSDomain(content); + return openTag + content + closeTag; + }), + ) ).replace(/(\r\n|\n|\r)/gm, ' '); if (isAttachment && parentReportActionMessage) { return `[${Localize.translateLocal('common.attachment')}]`; From b84da76c5c3bc20ccf8a1fa43bae62220385f4f7 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 10 Apr 2024 16:24:56 +0700 Subject: [PATCH 2/4] fix lint --- src/libs/ReportUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d22ac77bcb09..128d105b4d7f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2876,9 +2876,9 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu ReportActionsUtils.isApprovedOrSubmittedReportAction(parentReportAction) ? ReportActionsUtils.getReportActionMessageText(parentReportAction) : parser.htmlToText( - (parentReportAction?.message?.[0]?.html ?? '').replace(/()(.*?)(<\/mention-user>)/gi, function (match, openTag, content, closeTag) { - content = Str.removeSMSDomain(content); - return openTag + content + closeTag; + (parentReportAction?.message?.[0]?.html ?? '').replace(/()(.*?)(<\/mention-user>)/gi, (match, openTag, content, closeTag) => { + const innerContent = Str.removeSMSDomain(content); + return openTag + innerContent + closeTag; }), ) ).replace(/(\r\n|\n|\r)/gm, ' '); From e28aaacfe6949aeb7e6d46d51e860428eb96f2c5 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 15 Apr 2024 15:49:32 +0700 Subject: [PATCH 3/4] fix using the main solution --- src/libs/ReportUtils.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f91f6b3c96d9..093f019aa413 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2949,12 +2949,7 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu const parentReportActionMessage = ( ReportActionsUtils.isApprovedOrSubmittedReportAction(parentReportAction) ? ReportActionsUtils.getReportActionMessageText(parentReportAction) - : parser.htmlToText( - (parentReportAction?.message?.[0]?.html ?? '').replace(/()(.*?)(<\/mention-user>)/gi, (match, openTag, content, closeTag) => { - const innerContent = Str.removeSMSDomain(content); - return openTag + innerContent + closeTag; - }), - ) + : Str.removeSMSDomain(parentReportAction?.message?.[0]?.text ?? '') ).replace(/(\r\n|\n|\r)/gm, ' '); if (isAttachment && parentReportActionMessage) { return `[${Localize.translateLocal('common.attachment')}]`; From 8b70ff289293c086b68c5c54d36e6a6b5679953e Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 15 Apr 2024 15:50:05 +0700 Subject: [PATCH 4/4] fix lint --- src/libs/ReportUtils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 093f019aa413..0042ad3f7599 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2945,7 +2945,6 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu } const isAttachment = ReportActionsUtils.isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : null); - const parser = new ExpensiMark(); const parentReportActionMessage = ( ReportActionsUtils.isApprovedOrSubmittedReportAction(parentReportAction) ? ReportActionsUtils.getReportActionMessageText(parentReportAction)