From ac87753d2557f6c8621d5212a73e8c42b51bc5ec Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Tue, 8 Oct 2024 15:26:06 +0100 Subject: [PATCH 1/2] Fix expense report avatar --- .../home/report/ReportActionItemSingle.tsx | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index ca11a1b02d26..06dd57acfaac 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -95,13 +95,18 @@ function ReportActionItemSingle({ let actorHint = (login || (displayName ?? '')).replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, ''); const isTripRoom = ReportUtils.isTripRoom(report); const isReportPreviewAction = action?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW; - const displayAllActors = isReportPreviewAction && !isTripRoom; + const displayAllActors = isReportPreviewAction && !isTripRoom && !ReportUtils.isPolicyExpenseChat(report); const isInvoiceReport = ReportUtils.isInvoiceReport(iouReport ?? null); const isWorkspaceActor = isInvoiceReport || (ReportUtils.isPolicyExpenseChat(report) && (!actorAccountID || displayAllActors)); const ownerAccountID = iouReport?.ownerAccountID ?? action?.childOwnerAccountID; let avatarSource = avatar; let avatarId: number | string | undefined = actorAccountID; + if (isReportPreviewAction && ReportUtils.isPolicyExpenseChat(report)) { + avatarId = ownerAccountID; + avatarSource = personalDetails[ownerAccountID ?? -1]?.avatar; + displayName = ReportUtils.getDisplayNameForParticipant(ownerAccountID); + } if (isWorkspaceActor) { displayName = ReportUtils.getPolicyName(report, undefined, policy); actorHint = displayName; @@ -193,6 +198,15 @@ function ReportActionItemSingle({ ); const getAvatar = () => { + if (shouldShowSubscriptAvatar) { + return ( + + ); + } if (displayAllActors) { return ( ); } - if (shouldShowSubscriptAvatar) { - return ( - - ); - } return ( Date: Tue, 8 Oct 2024 15:48:23 +0100 Subject: [PATCH 2/2] fix tooltip display name --- src/pages/home/report/ReportActionItemSingle.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 06dd57acfaac..5e1f0a591532 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -106,6 +106,7 @@ function ReportActionItemSingle({ avatarId = ownerAccountID; avatarSource = personalDetails[ownerAccountID ?? -1]?.avatar; displayName = ReportUtils.getDisplayNameForParticipant(ownerAccountID); + actorHint = displayName; } if (isWorkspaceActor) { displayName = ReportUtils.getPolicyName(report, undefined, policy);