From 519c08c1e6442cc1cd2a3cc6c92d8b9744fd38b6 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Thu, 23 Nov 2023 10:26:35 +0100 Subject: [PATCH] fix: minor fix for displaying last actor --- src/libs/ReportUtils.js | 11 +++++++++-- src/libs/SidebarUtils.ts | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index c1f44785c5ca..6cb37b57a431 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1857,7 +1857,14 @@ function getActorNameForPreviewMessage({report, actorID, shouldShowWorkspaceName * @param {Object} [policy] * @returns {String} */ -function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceiptBeingScanned = false, isPreviewMessageForParentChatReport = false, shouldHideParticipantName = false, policy = undefined) { +function getReportPreviewMessage( + report, + reportAction = {}, + shouldConsiderReceiptBeingScanned = false, + isPreviewMessageForParentChatReport = false, + shouldHideParticipantName = false, + policy = undefined, +) { const reportActionMessage = lodashGet(reportAction, 'message[0].html', ''); if (_.isEmpty(report) || !report.reportID) { @@ -1886,7 +1893,7 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip actorID: report.managerID, shouldUseShortForm: true, shouldShowWorkspaceName: isExpenseReport(report), - policy + policy, }); const payerName = shouldHideParticipantName ? '' : payerDisplayName; const formattedAmount = CurrencyUtils.convertToDisplayString(totalAmount, report.currency); diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 763a0000ba35..c3312ebebae9 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -406,7 +406,8 @@ function getOptionData( } : null; } - const lastActorDisplayName = hasMultipleParticipants && lastActorDetails?.accountID && Number(lastActorDetails.accountID) !== currentUserAccountID ? lastActorDetails.displayName : ''; + const lastActorDisplayName = + hasMultipleParticipants && lastActorDetails?.accountID && Number(lastActorDetails.accountID) !== currentUserAccountID ? lastActorDetails.displayName?.split(' ')[0] : ''; let lastMessageText = lastMessageTextFromReport; const reportAction = lastReportActions?.[report.reportID];