From cd477451c10cb64bdb9b179048cba485e5404102 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Thu, 16 Nov 2023 15:11:25 +0530 Subject: [PATCH] Merge pull request #31420 from parasharrajat/small-fix [CP staging]Import Permissions lib and fix App crash (cherry picked from commit 2b4909d5cf7b0edf005ed324250d8f8c08960bfe) --- src/components/ReportActionItem/MoneyRequestView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index 5b9a1b2212c7..85ecb914439a 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -16,6 +16,7 @@ import Text from '@components/Text'; import transactionPropTypes from '@components/transactionPropTypes'; import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes} from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; +import usePermissions from '@hooks/usePermissions'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CardUtils from '@libs/CardUtils'; import compose from '@libs/compose'; @@ -76,6 +77,7 @@ const defaultProps = { function MoneyRequestView({report, parentReport, policyCategories, shouldShowHorizontalRule, transaction, policyTags, policy}) { const {isSmallScreenWidth} = useWindowDimensions(); const {translate} = useLocalize(); + const {canUseViolations} = usePermissions(); const parentReportAction = ReportActionsUtils.getParentReportAction(report); const moneyRequestReport = parentReport; const { @@ -173,7 +175,7 @@ function MoneyRequestView({report, parentReport, policyCategories, shouldShowHor )} - {!hasReceipt && canEdit && !isSettled && Permissions.canUseViolations() && ( + {!hasReceipt && canEdit && !isSettled && canUseViolations && ( Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT))}