Skip to content

Commit

Permalink
Fix name in rules beta permission method
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Aug 21, 2024
1 parent 1fd206a commit 8970dd4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function canUseNetSuiteUSATax(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.NETSUITE_USA_TAX) || canUseAllBetas(betas);
}

function canWorkspaceRules(betas: OnyxEntry<Beta[]>): boolean {
function canUseWorkspaceRules(betas: OnyxEntry<Beta[]>): boolean {
return !!betas?.includes(CONST.BETAS.WORKSPACE_RULES) || canUseAllBetas(betas);
}

Expand All @@ -56,5 +56,5 @@ export default {
canUseSpotnanaTravel,
canUseWorkspaceFeeds,
canUseNetSuiteUSATax,
canWorkspaceRules,
canUseWorkspaceRules,
};
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc
const activeRoute = useNavigationState(getTopmostRouteName);
const {translate} = useLocalize();
const {isOffline} = useNetwork();
const {canWorkspaceRules} = usePermissions();
const {canUseWorkspaceRules} = usePermissions();
const wasRendered = useRef(false);

const prevPendingFields = usePrevious(policy?.pendingFields);
Expand Down Expand Up @@ -310,7 +310,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc
});
}

if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED] && canWorkspaceRules) {
if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED] && canUseWorkspaceRules) {
protectedCollectPolicyMenuItems.push({
translationKey: 'workspace.common.rules',
icon: Expensicons.Feed,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceMoreFeaturesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {translate} = useLocalize();
const {canUseWorkspaceFeeds, canWorkspaceRules} = usePermissions();
const {canUseWorkspaceFeeds, canUseWorkspaceRules} = usePermissions();
const hasAccountingConnection = !isEmptyObject(policy?.connections);
const isAccountingEnabled = !!policy?.areConnectionsEnabled || !isEmptyObject(policy?.connections);
const isSyncTaxEnabled =
Expand Down Expand Up @@ -130,7 +130,7 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro
];

// TODO remove this when feature will be fully done, and move manage item inside manageItems array
if (canWorkspaceRules) {
if (canUseWorkspaceRules) {
manageItems.splice(1, 0, {
icon: Illustrations.Rules,
titleTranslationKey: 'workspace.moreFeatures.rules.title',
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/rules/PolicyRulesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function PolicyRulesPage({route}: PolicyRulesPageProps) {
const policy = usePolicy(policyID);
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {canWorkspaceRules} = usePermissions();
const {canUseWorkspaceRules} = usePermissions();

const handleOnPressCategoriesLink = () => {
if (policy?.areCategoriesEnabled) {
Expand Down Expand Up @@ -60,7 +60,7 @@ function PolicyRulesPage({route}: PolicyRulesPageProps) {
shouldShowOfflineIndicatorInWideScreen
route={route}
icon={Illustrations.Rules}
shouldShowNotFoundPage={!canWorkspaceRules}
shouldShowNotFoundPage={!canUseWorkspaceRules}
>
<View style={[styles.mt3, shouldUseNarrowLayout ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
Expand Down

0 comments on commit 8970dd4

Please sign in to comment.