From 69ad164d2388f963b139b8fd14d436e28f4d7210 Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Tue, 29 Oct 2024 13:35:52 +0000 Subject: [PATCH] clean up --- src/libs/ReportUtils.ts | 7 +++---- src/pages/home/report/ReportActionItemSingle.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8be83c7c3ccc..09176ceefc8f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2298,7 +2298,7 @@ function getIcons( if (isChatThread(report)) { const parentReportAction = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]?.[report.parentReportActionID]; - const actorAccountID = getReportActionActorAccountID(parentReportAction, report); + const actorAccountID = getReportActionActorAccountID(parentReportAction, report, report); const actorDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(allPersonalDetails?.[actorAccountID ?? -1], '', false); const actorIcon = { id: actorAccountID, @@ -8037,13 +8037,13 @@ function canLeaveChat(report: OnyxEntry, policy: OnyxEntry): boo function getReportActionActorAccountID( reportAction: OnyxInputOrEntry, iouReport: OnyxInputOrEntry | undefined, - isPolicyExpenseChatParam: boolean | undefined, + report: OnyxInputOrEntry | undefined, ): number | undefined { switch (reportAction?.actionName) { case CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW: { const ownerAccountID = iouReport?.ownerAccountID ?? reportAction?.childOwnerAccountID; const actorAccountID = iouReport?.managerID ?? reportAction?.childManagerAccountID; - return isPolicyExpenseChatParam ? ownerAccountID : actorAccountID; + return isPolicyExpenseChat(report) ? ownerAccountID : actorAccountID; } case CONST.REPORT.ACTIONS.TYPE.SUBMITTED: @@ -8053,7 +8053,6 @@ function getReportActionActorAccountID( return reportAction?.actorAccountID; } } - function createDraftWorkspaceAndNavigateToConfirmationScreen(transactionID: string, actionName: IOUAction): void { const isCategorizing = actionName === CONST.IOU.ACTION.CATEGORIZE; const {expenseChatReportID, policyID, policyName} = PolicyActions.createDraftWorkspace(); diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 462fc16540b9..0fed9d8a6c49 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -87,7 +87,7 @@ function ReportActionItemSingle({ const delegatePersonalDetails = personalDetails[action?.delegateAccountID ?? '']; const ownerAccountID = iouReport?.ownerAccountID ?? action?.childOwnerAccountID; const isReportPreviewAction = action?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW; - const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport, ReportUtils.isPolicyExpenseChat(report)); + const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport, report); const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`); let displayName = ReportUtils.getDisplayNameForParticipant(actorAccountID);