Skip to content

Commit

Permalink
remove the manager check
Browse files Browse the repository at this point in the history
  • Loading branch information
lakchote committed Jul 17, 2024
1 parent 68ab5c6 commit f3b3437
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
16 changes: 2 additions & 14 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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;

Expand Down
10 changes: 1 addition & 9 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ type ReportPreviewOnyxProps = {
/** The policy tied to the expense report */
policy: OnyxEntry<Policy>;

session: OnyxEntry<Session>;

/** ChatReport associated with iouReport */
chatReport: OnyxEntry<Report>;

Expand Down Expand Up @@ -98,7 +96,6 @@ function ReportPreview({
iouReport,
policy,
iouReportID,
session,
policyID,
chatReportID,
chatReport,
Expand All @@ -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),
Expand Down Expand Up @@ -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 (
<OfflineWithFeedback
Expand Down Expand Up @@ -517,7 +512,4 @@ export default withOnyx<ReportPreviewProps, ReportPreviewOnyxProps>({
userWallet: {
key: ONYXKEYS.USER_WALLET,
},
session: {
key: ONYXKEYS.SESSION,
},
})(ReportPreview);
1 change: 0 additions & 1 deletion src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
reportActions={reportActions}
shouldUseNarrowLayout={shouldUseNarrowLayout}
onBackButtonPress={onBackButtonPress}
currentUserAccountID={currentUserAccountID}
/>
);
}
Expand Down

0 comments on commit f3b3437

Please sign in to comment.