Skip to content

Commit e53cb65

Browse files
authored
Merge pull request Expensify#91091 from Expensify/arosiclair-restrict-billing-params
Fix params for shouldRestrictUserBillableActions calls
2 parents d29bd94 + 80586bc commit e53cb65

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/components/MoneyRequestHeaderSecondaryActions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
359359
iconFill: isDuplicateActive ? undefined : theme.icon,
360360
value: CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.DUPLICATE,
361361
onSelected: () => {
362-
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
362+
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
363363
dropdownMenuRef.current?.setIsMenuVisible(false);
364364
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(defaultExpensePolicy.id));
365365
return;

src/hooks/useExpenseActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
322322
iconFill: isDuplicateActive ? undefined : theme.icon,
323323
value: CONST.REPORT.SECONDARY_ACTIONS.DUPLICATE_EXPENSE,
324324
onSelected: () => {
325-
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
325+
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
326326
onDuplicateReset?.();
327327
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(defaultExpensePolicy.id));
328328
return;
@@ -383,7 +383,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
383383
const isSourcePolicyValid = !!policy && isPolicyAccessible(policy, currentUserLogin ?? '');
384384
const targetPolicyForDuplicate = isSourcePolicyValid ? policy : defaultExpensePolicy;
385385

386-
if (targetPolicyForDuplicate && shouldRestrictUserBillableActions(targetPolicyForDuplicate.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
386+
if (targetPolicyForDuplicate && shouldRestrictUserBillableActions(targetPolicyForDuplicate, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
387387
onDuplicateReset?.();
388388
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(targetPolicyForDuplicate.id));
389389
return;

src/hooks/useSearchBulkActions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react-hooks/refs */
12
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
23
// eslint-disable-next-line no-restricted-imports
34
import {InteractionManager} from 'react-native';
@@ -1134,7 +1135,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
11341135
value: CONST.SEARCH.BULK_ACTION_TYPES.DUPLICATE,
11351136
shouldCloseModalOnSelect: true,
11361137
onSelected: () => {
1137-
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
1138+
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
11381139
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(defaultExpensePolicy.id));
11391140
return;
11401141
}
@@ -1483,7 +1484,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
14831484
value: CONST.SEARCH.BULK_ACTION_TYPES.DUPLICATE,
14841485
shouldCloseModalOnSelect: true,
14851486
onSelected: () => {
1486-
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy.id, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
1487+
if (defaultExpensePolicy && shouldRestrictUserBillableActions(defaultExpensePolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
14871488
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(defaultExpensePolicy.id));
14881489
return;
14891490
}

0 commit comments

Comments
 (0)