From f3b343763f922cd3f38c0615636df423a7fccbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucien=20Akchot=C3=A9?= Date: Wed, 17 Jul 2024 14:53:23 +0200 Subject: [PATCH] remove the manager check --- src/components/MoneyReportHeader.tsx | 16 ++-------------- .../ReportActionItem/ReportPreview.tsx | 10 +--------- src/pages/home/ReportScreen.tsx | 1 - 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index d47084bc7aba..1acee187c67b 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -55,22 +55,11 @@ type MoneyReportHeaderProps = { /** Whether we should display the header as in narrow layout */ shouldUseNarrowLayout?: boolean; - /** The accountID of the current user */ - currentUserAccountID: number; - /** Method to trigger when pressing close button of the header */ onBackButtonPress: () => void; }; -function MoneyReportHeader({ - policy, - report: moneyRequestReport, - transactionThreadReportID, - reportActions, - shouldUseNarrowLayout = false, - onBackButtonPress, - currentUserAccountID, -}: MoneyReportHeaderProps) { +function MoneyReportHeader({policy, report: moneyRequestReport, transactionThreadReportID, reportActions, shouldUseNarrowLayout = false, onBackButtonPress}: MoneyReportHeaderProps) { const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport.chatReportID}`); const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport.reportID}`); const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`); @@ -129,9 +118,8 @@ function MoneyReportHeader({ const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0 && !allHavePendingRTERViolation; - const isManager = currentUserAccountID === moneyRequestReport?.managerID; const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN; - const shouldShowExportIntegrationButton = !shouldShowPayButton && !shouldShowSubmitButton && connectedIntegration && (isManager || isAdmin); + const shouldShowExportIntegrationButton = !shouldShowPayButton && !shouldShowSubmitButton && connectedIntegration && isAdmin; const shouldShowSettlementButton = (shouldShowPayButton || shouldShowApproveButton) && !allHavePendingRTERViolation && !shouldShowExportIntegrationButton; diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index b9d824375c42..ed64a088bea9 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -47,8 +47,6 @@ type ReportPreviewOnyxProps = { /** The policy tied to the expense report */ policy: OnyxEntry; - session: OnyxEntry; - /** ChatReport associated with iouReport */ chatReport: OnyxEntry; @@ -98,7 +96,6 @@ function ReportPreview({ iouReport, policy, iouReportID, - session, policyID, chatReportID, chatReport, @@ -118,7 +115,6 @@ function ReportPreview({ const {canUseViolations} = usePermissions(); const {isOffline} = useNetwork(); - const currentUserAccountID = session?.accountID; const {hasMissingSmartscanFields, areAllRequestsBeingSmartScanned, hasOnlyTransactionsWithPendingRoutes, hasNonReimbursableTransactions} = useMemo( () => ({ hasMissingSmartscanFields: ReportUtils.hasMissingSmartscanFields(iouReportID), @@ -345,9 +341,8 @@ function ReportPreview({ */ const connectedIntegration = PolicyUtils.getConnectedIntegration(policy); - const isManager = currentUserAccountID === iouReport?.managerID; const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN; - const shouldShowExportIntegrationButton = !shouldShowPayButton && !shouldShowSubmitButton && connectedIntegration && (isManager || isAdmin); + const shouldShowExportIntegrationButton = !shouldShowPayButton && !shouldShowSubmitButton && connectedIntegration && isAdmin; return ( ({ userWallet: { key: ONYXKEYS.USER_WALLET, }, - session: { - key: ONYXKEYS.SESSION, - }, })(ReportPreview); diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index c06fdbf5f86c..49897928ffe9 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -358,7 +358,6 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro reportActions={reportActions} shouldUseNarrowLayout={shouldUseNarrowLayout} onBackButtonPress={onBackButtonPress} - currentUserAccountID={currentUserAccountID} /> ); }