Skip to content

Commit a3df238

Browse files
authored
Merge pull request Expensify#45739 from Expensify/yuwen-rterViolation
Remove unneccessary hiding of mark as cash button on submitted reports
2 parents 0d70442 + 58fefc7 commit a3df238

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/components/MoneyReportHeader.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
124124
const shouldShowSettlementButton = (shouldShowPayButton || shouldShowApproveButton) && !allHavePendingRTERViolation && !shouldShowExportIntegrationButton;
125125

126126
const shouldDisableSubmitButton = shouldShowSubmitButton && !ReportUtils.isAllowedToSubmitDraftExpenseReport(moneyRequestReport);
127-
const shouldShowMarkAsCashButton = isDraft && allHavePendingRTERViolation;
128127
const isFromPaidPolicy = policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.CORPORATE;
129128
const shouldShowStatusBar = allHavePendingRTERViolation || hasOnlyHeldExpenses || hasScanningReceipt;
130129
const shouldShowNextStep = !ReportUtils.isClosedExpenseReportWithNoExpenses(moneyRequestReport) && isFromPaidPolicy && !!nextStep?.message?.length && !shouldShowStatusBar;
@@ -304,7 +303,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
304303
/>
305304
</View>
306305
)}
307-
{shouldShowMarkAsCashButton && !shouldUseNarrowLayout && (
306+
{allHavePendingRTERViolation && !shouldUseNarrowLayout && (
308307
<View style={[styles.pv2]}>
309308
<Button
310309
medium
@@ -353,7 +352,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
353352
isDisabled={shouldDisableSubmitButton}
354353
/>
355354
)}
356-
{shouldShowMarkAsCashButton && shouldUseNarrowLayout && (
355+
{allHavePendingRTERViolation && shouldUseNarrowLayout && (
357356
<Button
358357
medium
359358
success

src/components/MoneyRequestHeader.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import useThemeStyles from '@hooks/useThemeStyles';
99
import useWindowDimensions from '@hooks/useWindowDimensions';
1010
import Navigation from '@libs/Navigation/Navigation';
1111
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
12-
import * as ReportUtils from '@libs/ReportUtils';
1312
import * as TransactionUtils from '@libs/TransactionUtils';
1413
import variables from '@styles/variables';
1514
import * as IOU from '@userActions/IOU';
@@ -58,15 +57,11 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow
5857
const theme = useTheme();
5958
const {translate} = useLocalize();
6059
const [shouldShowHoldMenu, setShouldShowHoldMenu] = useState(false);
61-
const isSelfDMTrackExpenseReport = ReportUtils.isTrackExpenseReport(report) && ReportUtils.isSelfDM(parentReport);
62-
const moneyRequestReport = !isSelfDMTrackExpenseReport ? parentReport : undefined;
63-
const isDraft = ReportUtils.isOpenExpenseReport(moneyRequestReport);
6460
const isOnHold = TransactionUtils.isOnHold(transaction);
6561
const isDuplicate = TransactionUtils.isDuplicate(transaction?.transactionID ?? '');
6662
const {isSmallScreenWidth} = useWindowDimensions();
6763

6864
const hasAllPendingRTERViolations = TransactionUtils.allHavePendingRTERViolation([transaction?.transactionID ?? '-1']);
69-
const shouldShowMarkAsCashButton = isDraft && hasAllPendingRTERViolations;
7065

7166
const markAsCash = useCallback(() => {
7267
TransactionActions.markAsCash(transaction?.transactionID ?? '-1', report.reportID);
@@ -142,7 +137,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow
142137
shouldShowBackButton={shouldUseNarrowLayout}
143138
onBackButtonPress={onBackButtonPress}
144139
>
145-
{shouldShowMarkAsCashButton && !shouldUseNarrowLayout && (
140+
{hasAllPendingRTERViolations && !shouldUseNarrowLayout && (
146141
<Button
147142
success
148143
medium
@@ -163,7 +158,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow
163158
/>
164159
)}
165160
</HeaderWithBackButton>
166-
{shouldShowMarkAsCashButton && shouldUseNarrowLayout && (
161+
{hasAllPendingRTERViolations && shouldUseNarrowLayout && (
167162
<View style={[styles.ph5, styles.pb3]}>
168163
<Button
169164
medium

0 commit comments

Comments
 (0)