From 39c12f8f8ab5167129f55a0303164cb5d072ae6a Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Mar 2026 22:06:55 +0800 Subject: [PATCH 1/7] rename --- .../MoneyRequestReportTransactionList.tsx | 6 +++--- .../SearchMoneyRequestReportEmptyState.tsx | 8 ++++---- src/hooks/useSearchBulkActions.ts | 14 ++++++------- src/libs/ReportUtils.ts | 14 ++++++------- src/libs/SubscriptionUtils.ts | 8 ++++---- src/pages/ReportDetailsPage.tsx | 10 +++++----- .../WorkspaceRestrictedActionPage.tsx | 6 +++--- .../inbox/report/PureReportActionItem.tsx | 12 +++++------ src/pages/inbox/report/ReportActionItem.tsx | 6 +++--- .../MoneyRequestParticipantsSelector.tsx | 6 +++--- tests/actions/IOUTest.ts | 12 +++++------ tests/ui/ClearReportActionErrorsUITest.tsx | 2 +- tests/ui/PureReportActionItemTest.tsx | 12 +++++------ tests/unit/ReportUtilsTest.ts | 20 +++++++++---------- 14 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index b9f909d986451..2118290ea9dec 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -188,7 +188,7 @@ function MoneyRequestReportTransactionList({ const currentUserDetails = useCurrentUserPersonalDetails(); const isReportArchived = useReportIsArchived(report?.reportID); const shouldShowAddExpenseButton = canAddTransaction(report, isReportArchived) && isCurrentUserSubmitter(report); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); const [lastDistanceExpenseType] = useOnyx(ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE); const [reportLayoutGroupBy] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY); @@ -205,14 +205,14 @@ function MoneyRequestReportTransactionList({ expensifyIcons, report?.reportID, policy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod, undefined, undefined, lastDistanceExpenseType, ), - [translate, expensifyIcons, report?.reportID, policy, userBillingGraceEndPeriodCollection, amountOwed, lastDistanceExpenseType, ownerBillingGraceEndPeriod], + [translate, expensifyIcons, report?.reportID, policy, userBillingGraceEndPeriods, amountOwed, lastDistanceExpenseType, ownerBillingGraceEndPeriod], ); const hasPendingAction = useMemo(() => { diff --git a/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx b/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx index f62a0b44325b0..b792c0bc57ca8 100644 --- a/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx +++ b/src/components/MoneyRequestReportView/SearchMoneyRequestReportEmptyState.tsx @@ -20,7 +20,7 @@ import type * as OnyxTypes from '@src/types/onyx'; const minModalHeight = 380; function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: OnyxTypes.Report; policy?: OnyxTypes.Policy; onLayout?: (event: LayoutChangeEvent) => void}) { - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`); const {translate} = useLocalize(); @@ -41,7 +41,7 @@ function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: if (!reportId) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -56,7 +56,7 @@ function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: if (!reportId) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -68,7 +68,7 @@ function SearchMoneyRequestReportEmptyState({report, policy, onLayout}: {report: text: translate('iou.addUnreportedExpense'), icon: icons.ReceiptPlus, onSelected: () => { - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } diff --git a/src/hooks/useSearchBulkActions.ts b/src/hooks/useSearchBulkActions.ts index 428fdd9102009..b9072ff130af6 100644 --- a/src/hooks/useSearchBulkActions.ts +++ b/src/hooks/useSearchBulkActions.ts @@ -99,7 +99,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const [csvExportLayouts] = useOnyx(ONYXKEYS.NVP_CSV_EXPORT_LAYOUTS); const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); // Cache the last search results that had data, so the merge option remains available // while results are temporarily unset (e.g. during sorting/loading). @@ -371,7 +371,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const selectedItems = selectedReports.length ? selectedReports : Object.values(selectedTransactions); - const restrictedPolicyID = getRestrictedPolicyID(selectedItems, userBillingGraceEndPeriodCollection); + const restrictedPolicyID = getRestrictedPolicyID(selectedItems, userBillingGraceEndPeriods); if (restrictedPolicyID) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictedPolicyID)); return; @@ -420,7 +420,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { translate, hash, clearSelectedTransactions, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, ]); const {expenseCount, uniqueReportCount} = useMemo(() => { @@ -540,7 +540,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const selectedOptions = selectedReports.length ? selectedReports : Object.values(selectedTransactions); - const restrictedPolicyID = getRestrictedPolicyID(selectedOptions, userBillingGraceEndPeriodCollection); + const restrictedPolicyID = getRestrictedPolicyID(selectedOptions, userBillingGraceEndPeriods); if (restrictedPolicyID) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictedPolicyID)); return; @@ -658,7 +658,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { personalPolicyID, allTransactions, allReports, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, ], ); @@ -855,7 +855,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { const itemList = !selectedReports.length ? Object.values(selectedTransactions).map((transaction) => transaction) : (selectedReports?.filter((report) => !!report) ?? []); - const restrictedPolicyID = getRestrictedPolicyID(itemList, userBillingGraceEndPeriodCollection); + const restrictedPolicyID = getRestrictedPolicyID(itemList, userBillingGraceEndPeriods); if (restrictedPolicyID) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictedPolicyID)); return; @@ -1103,7 +1103,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { styles.colorMuted, styles.fontWeightNormal, styles.textWrap, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, ]); const handleOfflineModalClose = useCallback(() => { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 21f2fd9bccc7e..3c9f5039488c0 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2987,7 +2987,7 @@ function getAddExpenseDropdownOptions( icons: Record<'Location' | 'ReceiptPlus', IconAsset>, iouReportID: string | undefined, policy: OnyxEntry, - userBillingGraceEndPeriodCollection: OnyxCollection, + userBillingGraceEndPeriods: OnyxCollection, amountOwed: OnyxEntry, ownerBillingGraceEndPeriod: OnyxEntry, iouRequestBackToReport?: string, @@ -3007,7 +3007,7 @@ function getAddExpenseDropdownOptions( if ( policy && policy.type !== CONST.POLICY.TYPE.PERSONAL && - shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, amountOwed, ownerBillingGraceEndPeriod) + shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod) ) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; @@ -3024,7 +3024,7 @@ function getAddExpenseDropdownOptions( if (!iouReportID) { return; } - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, amountOwed, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -3037,7 +3037,7 @@ function getAddExpenseDropdownOptions( icon: icons.ReceiptPlus, sentryLabel: CONST.SENTRY_LABEL.MORE_MENU.ADD_EXPENSE_UNREPORTED, onSelected: () => { - if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriodCollection, amountOwed, ownerBillingGraceEndPeriod)) { + if (policy && shouldRestrictUserBillableActions(policy.id, userBillingGraceEndPeriods, amountOwed, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id)); return; } @@ -11237,7 +11237,7 @@ type CreateDraftTransactionParams = { introSelected: OnyxEntry; allTransactionDrafts: OnyxCollection; activePolicy: OnyxEntry; - userBillingGraceEndPeriodCollection: OnyxCollection; + userBillingGraceEndPeriods: OnyxCollection; amountOwed: OnyxEntry; isRestrictedToPreferredPolicy?: boolean; preferredPolicyID?: string; @@ -11251,7 +11251,7 @@ function createDraftTransactionAndNavigateToParticipantSelector({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, isRestrictedToPreferredPolicy = false, preferredPolicyID, @@ -11318,7 +11318,7 @@ function createDraftTransactionAndNavigateToParticipantSelector({ } if (actionName === CONST.IOU.ACTION.CATEGORIZE) { - if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriodCollection, amountOwed)) { + if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id, userBillingGraceEndPeriods, amountOwed)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(activePolicy.id)); return; } diff --git a/src/libs/SubscriptionUtils.ts b/src/libs/SubscriptionUtils.ts index db4c6f1d266d1..5349bb46fe6be 100644 --- a/src/libs/SubscriptionUtils.ts +++ b/src/libs/SubscriptionUtils.ts @@ -72,10 +72,10 @@ Onyx.connect({ callback: (value) => (ownerBillingGraceEndPeriodDeprecated = value), }); -let deprecatedUserBillingGraceEndPeriodCollection: OnyxCollection; +let deprecatedUserBillingGraceEndPeriods: OnyxCollection; Onyx.connect({ key: ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END, - callback: (value) => (deprecatedUserBillingGraceEndPeriodCollection = value), + callback: (value) => (deprecatedUserBillingGraceEndPeriods = value), waitForCollectionCallback: true, }); @@ -470,7 +470,7 @@ function doesUserHavePaymentCardAdded(userBillingFundID: number | undefined): bo */ function shouldRestrictUserBillableActions( policyID: string, - userBillingGraceEndPeriodCollection: OnyxCollection = deprecatedUserBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods: OnyxCollection = deprecatedUserBillingGraceEndPeriods, amountOwed: OnyxEntry = privateAmountOwed, ownerBillingGraceEndPeriod: OnyxEntry = ownerBillingGraceEndPeriodDeprecated, ): boolean { @@ -481,7 +481,7 @@ function shouldRestrictUserBillableActions( // This logic will be executed if the user is a workspace's non-owner (normal user or admin). // We should restrict the workspace's non-owner actions if it's member of a workspace where the owner is // past due and is past its grace period end. - for (const userBillingGraceEndPeriodEntry of Object.entries(userBillingGraceEndPeriodCollection ?? {})) { + for (const userBillingGraceEndPeriodEntry of Object.entries(userBillingGraceEndPeriods ?? {})) { const [entryKey, userBillingGracePeriodEnd] = userBillingGraceEndPeriodEntry; if (userBillingGracePeriodEnd && isAfter(currentDate, fromUnixTime(userBillingGracePeriodEnd.value))) { diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index da4bb7a036755..34c67390d8299 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -164,7 +164,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const expensifyIcons = useMemoizedLazyExpensifyIcons(['Users', 'Gear', 'Send', 'Folder', 'UserPlus', 'Pencil', 'Checkmark', 'Building', 'Exit', 'Bug', 'Camera', 'Trashcan']); const backTo = route.params.backTo; - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`); const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.chatReportID}`); @@ -460,7 +460,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, isRestrictedToPreferredPolicy, preferredPolicyID, @@ -483,7 +483,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -503,7 +503,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -631,7 +631,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail activePolicy, parentReport, reportActionsForOriginalReportID, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, ]); diff --git a/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx b/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx index b4ffbe76fa6c0..fe0d73616d53c 100644 --- a/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx +++ b/src/pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage.tsx @@ -41,17 +41,17 @@ function WorkspaceRestrictedActionPage({ }, []); // Watch billing NVPs so the component re-renders when fresh data arrives from the server. - const [userBillingGracePeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGracePeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); // Navigate back if the fresh server data shows the restriction no longer applies. useEffect(() => { if (isLoadingSubscriptionData !== false) { return; } - if (!shouldRestrictUserBillableActions(policyID, userBillingGracePeriodCollection)) { + if (!shouldRestrictUserBillableActions(policyID, userBillingGracePeriods)) { Navigation.goBack(); } - }, [policyID, isLoadingSubscriptionData, userBillingGracePeriodCollection]); + }, [policyID, isLoadingSubscriptionData, userBillingGracePeriods]); // Show a loading indicator while waiting for fresh billing data from the server, // instead of flashing the restriction UI which may no longer apply. diff --git a/src/pages/inbox/report/PureReportActionItem.tsx b/src/pages/inbox/report/PureReportActionItem.tsx index 874309618929e..e3cb36191e6a4 100644 --- a/src/pages/inbox/report/PureReportActionItem.tsx +++ b/src/pages/inbox/report/PureReportActionItem.tsx @@ -470,7 +470,7 @@ type PureReportActionItemProps = { reportMetadata?: OnyxEntry; /** The billing grace end period's shared NVP collection */ - userBillingGraceEndPeriodCollection: OnyxCollection; + userBillingGraceEndPeriods: OnyxCollection; }; // This is equivalent to returning a negative boolean in normal functions, but we can keep the element return type @@ -540,7 +540,7 @@ function PureReportActionItem({ reportNameValuePairsOrigin, reportNameValuePairsOriginalID, reportMetadata, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, }: PureReportActionItemProps) { const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED); const {transitionActionSheetState} = ActionSheetAwareScrollView.useActionSheetAwareScrollViewActions(); @@ -947,7 +947,7 @@ function PureReportActionItem({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, isRestrictedToPreferredPolicy, preferredPolicyID, @@ -970,7 +970,7 @@ function PureReportActionItem({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -987,7 +987,7 @@ function PureReportActionItem({ introSelected, allTransactionDrafts, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, }); }, @@ -1133,7 +1133,7 @@ function PureReportActionItem({ report, originalReport, personalPolicyID, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed, ]); diff --git a/src/pages/inbox/report/ReportActionItem.tsx b/src/pages/inbox/report/ReportActionItem.tsx index 3fafb482cdcdd..e83c924107de8 100644 --- a/src/pages/inbox/report/ReportActionItem.tsx +++ b/src/pages/inbox/report/ReportActionItem.tsx @@ -39,7 +39,7 @@ import PureReportActionItem from './PureReportActionItem'; type ReportActionItemProps = Omit< PureReportActionItemProps, - 'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport' | 'currentUserAccountID' | 'personalPolicyID' | 'allTransactionDrafts' | 'userBillingGraceEndPeriodCollection' + 'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport' | 'currentUserAccountID' | 'personalPolicyID' | 'allTransactionDrafts' | 'userBillingGraceEndPeriods' > & { /** All the data of the policy collection */ policies: OnyxCollection; @@ -116,7 +116,7 @@ function ReportActionItem({ const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const transactionsOnIOUReport = useReportTransactions(iouReport?.reportID); const transactionID = isMoneyRequestAction(action) && getOriginalMessage(action)?.IOUTransactionID; @@ -191,7 +191,7 @@ function ReportActionItem({ isTryNewDotNVPDismissed={isTryNewDotNVPDismissed} bankAccountList={bankAccountList} reportMetadata={reportMetadata} - userBillingGraceEndPeriodCollection={userBillingGraceEndPeriodCollection} + userBillingGraceEndPeriods={userBillingGraceEndPeriods} /> ); } diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index da97594ae6c6b..e8e6d79d7a279 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -115,7 +115,7 @@ function MoneyRequestParticipantsSelector({ const {isDismissed} = useDismissedReferralBanners({referralContentType}); const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy(); const {didScreenTransitionEnd} = useScreenWrapperTransitionStatus(); - const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`]; @@ -530,7 +530,7 @@ function MoneyRequestParticipantsSelector({ if ( option.isPolicyExpenseChat && option.policyID && - shouldRestrictUserBillableActions(option.policyID, userBillingGraceEndPeriodCollection, undefined, ownerBillingGraceEndPeriod) + shouldRestrictUserBillableActions(option.policyID, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod) ) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(option.policyID)); return; @@ -543,7 +543,7 @@ function MoneyRequestParticipantsSelector({ addSingleParticipant(option); }, - [isIOUSplit, addParticipantToSelection, addSingleParticipant, userBillingGraceEndPeriodCollection, ownerBillingGraceEndPeriod], + [isIOUSplit, addParticipantToSelection, addSingleParticipant, userBillingGraceEndPeriods, ownerBillingGraceEndPeriod], ); const importContactsButtonComponent = useMemo(() => { diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index 58fd2a9d22741..c3d967ceeac25 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -611,7 +611,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1172,7 +1172,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1584,7 +1584,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1632,7 +1632,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1669,7 +1669,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); @@ -1701,7 +1701,7 @@ describe('actions/IOU', () => { introSelected: {choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM}, allTransactionDrafts: {}, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); await waitForBatchedUpdates(); diff --git a/tests/ui/ClearReportActionErrorsUITest.tsx b/tests/ui/ClearReportActionErrorsUITest.tsx index fc7a5f1de3346..f9dccaee8b1b2 100644 --- a/tests/ui/ClearReportActionErrorsUITest.tsx +++ b/tests/ui/ClearReportActionErrorsUITest.tsx @@ -107,7 +107,7 @@ describe('ClearReportActionErrors UI', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} clearAllRelatedReportActionErrors={clearErrorFn} originalReportID={originalReportID} /> diff --git a/tests/ui/PureReportActionItemTest.tsx b/tests/ui/PureReportActionItemTest.tsx index ba9823fad509d..a9a8f919ed1d6 100644 --- a/tests/ui/PureReportActionItemTest.tsx +++ b/tests/ui/PureReportActionItemTest.tsx @@ -111,7 +111,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -318,7 +318,7 @@ describe('PureReportActionItem', () => { reportMetadata={reportMetadata} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -376,7 +376,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -446,7 +446,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -511,7 +511,7 @@ describe('PureReportActionItem', () => { iouReportOfLinkedReport={undefined} currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> @@ -563,7 +563,7 @@ describe('PureReportActionItem', () => { currentUserAccountID={ACTOR_ACCOUNT_ID} allTransactionDrafts={undefined} modifiedExpenseMessage={modifiedExpenseMessage} - userBillingGraceEndPeriodCollection={undefined} + userBillingGraceEndPeriods={undefined} /> diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 0107607018e03..bcb2f03f4900b 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -12752,7 +12752,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 1, }); @@ -12772,7 +12772,7 @@ describe('ReportUtils', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, transaction); await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${1}`, {}); await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${activePolicy.id}`, activePolicy); - const userBillingGraceEndPeriodCollection = { + const userBillingGraceEndPeriods = { [`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END}${ownerAccountID}`]: { value: 1, }, @@ -12787,7 +12787,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection, + userBillingGraceEndPeriods, amountOwed: 0, }); @@ -12825,7 +12825,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12865,7 +12865,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12892,7 +12892,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12940,7 +12940,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -12984,7 +12984,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -13026,7 +13026,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 0, }); @@ -13060,7 +13060,7 @@ describe('ReportUtils', () => { introSelected: undefined, allTransactionDrafts: undefined, activePolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, amountOwed: 50, }); From c8b2a820a65e95b1548507dcda2530fae1eb5dc5 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Mar 2026 22:25:50 +0800 Subject: [PATCH 2/7] pass userBillingGraceEndPeriods from useOnyx --- .../SearchPageHeader/SearchFiltersBarCreateButton.tsx | 7 +++++-- .../Search/ExpenseReportListItem.tsx | 2 ++ .../Search/ReportListItemHeader.tsx | 2 ++ .../Search/TransactionListItem.tsx | 2 ++ src/libs/actions/Search.ts | 8 +++++--- tests/unit/Search/handleActionButtonPressTest.ts | 2 ++ 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx b/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx index a5ada1499bb92..83723348776f5 100644 --- a/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx +++ b/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx @@ -57,6 +57,7 @@ function SearchFiltersBarCreateButton() { const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const {policyForMovingExpensesID, shouldSelectPolicy} = usePolicyForMovingExpenses(); const shouldNavigateToUpgradePath = !policyForMovingExpensesID && !shouldSelectPolicy; const {showConfirmModal} = useConfirmModal(); @@ -182,14 +183,14 @@ function SearchFiltersBarCreateButton() { // No default or restricted with multiple workspaces → workspace selector if ( !workspaceIDForReportCreation || - (shouldRestrictUserBillableActions(workspaceIDForReportCreation, undefined, undefined, ownerBillingGraceEndPeriod) && groupPoliciesWithChatEnabled.length > 1) + (shouldRestrictUserBillableActions(workspaceIDForReportCreation, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod) && groupPoliciesWithChatEnabled.length > 1) ) { Navigation.navigate(ROUTES.NEW_REPORT_WORKSPACE_SELECTION.getRoute()); return; } // Default workspace is not restricted → create report directly - if (!shouldRestrictUserBillableActions(workspaceIDForReportCreation, undefined, undefined, ownerBillingGraceEndPeriod)) { + if (!shouldRestrictUserBillableActions(workspaceIDForReportCreation, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { // Check if empty report confirmation should be shown if (shouldShowEmptyReportConfirmationForDefaultChatEnabledPolicy) { openCreateReportConfirmation(); @@ -212,6 +213,8 @@ function SearchFiltersBarCreateButton() { groupPoliciesWithChatEnabled.length, defaultChatEnabledPolicyID, shouldShowEmptyReportConfirmationForDefaultChatEnabledPolicy, + ownerBillingGraceEndPeriod, + userBillingGraceEndPeriods, openCreateReportConfirmation, handleCreateWorkspaceReport, ], diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx index b3b44b0286e0b..94ba6faff034d 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx @@ -54,6 +54,7 @@ function ExpenseReportListItem({ const {translate} = useLocalize(); const {isLargeScreenWidth} = useResponsiveLayout(); const {currentSearchHash, currentSearchKey, currentSearchResults} = useSearchStateContext(); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [isActionLoading] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportItem.reportID}`, {selector: isActionLoadingSelector}); const expensifyIcons = useMemoizedLazyExpensifyIcons(['DotIndicator']); const currentUserDetails = useCurrentUserPersonalDetails(); @@ -129,6 +130,7 @@ function ExpenseReportListItem({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, diff --git a/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx b/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx index f50152f645c7a..33d1927cf60d8 100644 --- a/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx +++ b/src/components/SelectionListWithSections/Search/ReportListItemHeader.tsx @@ -223,6 +223,7 @@ function ReportListItemHeader({ const theme = useTheme(); const {currentSearchHash, currentSearchKey, currentSearchResults: snapshot} = useSearchStateContext(); const {isLargeScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout(); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const thereIsFromAndTo = !!reportItem?.from && !!reportItem?.to; const showUserInfo = (reportItem.type === CONST.REPORT.TYPE.IOU && thereIsFromAndTo) || (reportItem.type === CONST.REPORT.TYPE.EXPENSE && !!reportItem?.from); const snapshotReport = useMemo(() => { @@ -245,6 +246,7 @@ function ReportListItemHeader({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, diff --git a/src/components/SelectionListWithSections/Search/TransactionListItem.tsx b/src/components/SelectionListWithSections/Search/TransactionListItem.tsx index cb7fa5715fc34..a66ddcae04897 100644 --- a/src/components/SelectionListWithSections/Search/TransactionListItem.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionListItem.tsx @@ -61,6 +61,7 @@ function TransactionListItem({ const {currentSearchHash, currentSearchKey, currentSearchResults} = useSearchStateContext(); const snapshotReport = (currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionItem.reportID}`] ?? {}) as Report; + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [isActionLoading] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${transactionItem.reportID}`, {selector: isActionLoadingSelector}); // Use active policy (user's current workspace) as fallback for self DM tracking expenses @@ -158,6 +159,7 @@ function TransactionListItem({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index b0864d3fbd7bc..fd3ad372e5b00 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -96,6 +96,7 @@ type HandleActionButtonPressParams = { snapshotReport: Report; snapshotPolicy: Policy; lastPaymentMethod: OnyxEntry; + userBillingGraceEndPeriods: OnyxCollection; currentSearchKey?: SearchKey; onDEWModalOpen?: () => void; isDEWBetaEnabled?: boolean; @@ -111,6 +112,7 @@ function handleActionButtonPress({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, currentSearchKey, onDEWModalOpen, isDEWBetaEnabled, @@ -134,7 +136,7 @@ function handleActionButtonPress({ onDelegateAccessRestricted?.(); return; } - if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID)) { + if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(snapshotReport.policyID)); return; } @@ -145,7 +147,7 @@ function handleActionButtonPress({ onDelegateAccessRestricted?.(); return; } - if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID)) { + if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(snapshotReport.policyID)); return; } @@ -156,7 +158,7 @@ function handleActionButtonPress({ approveMoneyRequestOnSearch(hash, item.reportID ? [item.reportID] : [], currentSearchKey); return; case CONST.SEARCH.ACTION_TYPES.SUBMIT: { - if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID)) { + if (snapshotReport.policyID && shouldRestrictUserBillableActions(snapshotReport.policyID, userBillingGraceEndPeriods)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(snapshotReport.policyID)); return; } diff --git a/tests/unit/Search/handleActionButtonPressTest.ts b/tests/unit/Search/handleActionButtonPressTest.ts index fa29076f3af66..6c5b1cb016747 100644 --- a/tests/unit/Search/handleActionButtonPressTest.ts +++ b/tests/unit/Search/handleActionButtonPressTest.ts @@ -313,6 +313,7 @@ describe('handleActionButtonPress', () => { snapshotPolicy: snapshotPolicy as Policy, lastPaymentMethod: mockLastPaymentMethod, personalPolicyID: undefined, + userBillingGraceEndPeriods: undefined, }); expect(goToItem).toHaveBeenCalledTimes(1); }); @@ -327,6 +328,7 @@ describe('handleActionButtonPress', () => { snapshotPolicy: snapshotPolicy as Policy, lastPaymentMethod: mockLastPaymentMethod, personalPolicyID: undefined, + userBillingGraceEndPeriods: undefined, }); expect(goToItem).toHaveBeenCalledTimes(0); }); From 5bf0cfdcc87de0a6ae526c3b26a27ad0a1c25249 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Mar 2026 22:33:00 +0800 Subject: [PATCH 3/7] pass userBillingGraceEndPeriods from useOnyx --- src/pages/AddUnreportedExpense.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/AddUnreportedExpense.tsx b/src/pages/AddUnreportedExpense.tsx index 0df54f7761d38..c820071f82f0d 100644 --- a/src/pages/AddUnreportedExpense.tsx +++ b/src/pages/AddUnreportedExpense.tsx @@ -58,6 +58,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); + const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const shouldShowUnreportedTransactionsSkeletons = isLoadingUnreportedTransactions && hasMoreUnreportedTransactionsResults && !isOffline; const initialSkeletonReasonAttributes: SkeletonSpanReasonAttributes = { @@ -293,7 +294,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { { buttonText: translate('iou.createExpense'), buttonAction: () => { - if (report && report.policyID && shouldRestrictUserBillableActions(report.policyID, undefined, undefined, ownerBillingGraceEndPeriod)) { + if (report && report.policyID && shouldRestrictUserBillableActions(report.policyID, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(report.policyID)); return; } From 438a1d995a04b6f3c1a2f314a14366ba3b311e90 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Mar 2026 22:48:04 +0800 Subject: [PATCH 4/7] prettier --- .../SearchPageHeader/SearchFiltersBarCreateButton.tsx | 3 ++- src/pages/iou/request/MoneyRequestParticipantsSelector.tsx | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx b/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx index 83723348776f5..f693b6604cd5b 100644 --- a/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx +++ b/src/components/Search/SearchPageHeader/SearchFiltersBarCreateButton.tsx @@ -183,7 +183,8 @@ function SearchFiltersBarCreateButton() { // No default or restricted with multiple workspaces → workspace selector if ( !workspaceIDForReportCreation || - (shouldRestrictUserBillableActions(workspaceIDForReportCreation, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod) && groupPoliciesWithChatEnabled.length > 1) + (shouldRestrictUserBillableActions(workspaceIDForReportCreation, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod) && + groupPoliciesWithChatEnabled.length > 1) ) { Navigation.navigate(ROUTES.NEW_REPORT_WORKSPACE_SELECTION.getRoute()); return; diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index e8e6d79d7a279..10d923ca90b41 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -527,11 +527,7 @@ function MoneyRequestParticipantsSelector({ const onSelectRow = useCallback( (option: Participant) => { - if ( - option.isPolicyExpenseChat && - option.policyID && - shouldRestrictUserBillableActions(option.policyID, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod) - ) { + if (option.isPolicyExpenseChat && option.policyID && shouldRestrictUserBillableActions(option.policyID, userBillingGraceEndPeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(option.policyID)); return; } From 5fedd16996c1dfde393d783bd0779f15a33be4d7 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 10 Mar 2026 23:10:09 +0800 Subject: [PATCH 5/7] pass userBillingGraceEndPeriods from useOnyx --- src/pages/NewReportWorkspaceSelectionPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/NewReportWorkspaceSelectionPage.tsx b/src/pages/NewReportWorkspaceSelectionPage.tsx index 9d5e3162ab22a..c6316132fdf76 100644 --- a/src/pages/NewReportWorkspaceSelectionPage.tsx +++ b/src/pages/NewReportWorkspaceSelectionPage.tsx @@ -71,6 +71,7 @@ function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPag const [hasDismissedEmptyReportsConfirmation] = useOnyx(ONYXKEYS.NVP_EMPTY_REPORTS_CONFIRMATION_DISMISSED); const [betas] = useOnyx(ONYXKEYS.BETAS); const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); + const [userBillingGracePeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [policies, fetchStatus] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const currentUserPersonalDetails = useCurrentUserPersonalDetails(); @@ -181,7 +182,7 @@ function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPag return; } - if (shouldRestrictUserBillableActions(policy.policyID, undefined, undefined, ownerBillingGraceEndPeriod)) { + if (shouldRestrictUserBillableActions(policy.policyID, userBillingGracePeriods, undefined, ownerBillingGraceEndPeriod)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.policyID)); return; } From d82a1c2258e2ca786962c248b68dd255b3d175c4 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 13 Mar 2026 20:32:43 +0800 Subject: [PATCH 6/7] rename --- src/components/MoneyReportHeader.tsx | 2 +- .../MoneyRequestReportPreviewContent.tsx | 2 +- tests/unit/ReportUtilsTest.ts | 30 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 39c27bbe33976..f2c7a67889808 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -1051,7 +1051,7 @@ function MoneyReportHeader({ icons: expensifyIcons, iouReportID: moneyRequestReport?.reportID, policy, - userBillingGraceEndPeriodCollection: userBillingGraceEndPeriods, + userBillingGraceEndPeriods, draftTransactionIDs, amountOwed, ownerBillingGraceEndPeriod, diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 0a6f33c5630c6..c6ca35b4f9150 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -717,7 +717,7 @@ function MoneyRequestReportPreviewContent({ icons: expensifyIcons, iouReportID: iouReport?.reportID, policy, - userBillingGraceEndPeriodCollection: userBillingGraceEndPeriods, + userBillingGraceEndPeriods, draftTransactionIDs, amountOwed, ownerBillingGraceEndPeriod, diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 1a25385c4ddd2..d6355b0d9db19 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -13663,7 +13663,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13677,7 +13677,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -13693,7 +13693,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13709,7 +13709,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13728,7 +13728,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: mockPolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed, ownerBillingGraceEndPeriod: undefined, @@ -13748,7 +13748,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: mockPolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13767,7 +13767,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: undefined, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13786,7 +13786,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13805,7 +13805,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed, ownerBillingGraceEndPeriod: undefined, @@ -13820,7 +13820,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: mockIouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: 0, ownerBillingGraceEndPeriod: undefined, @@ -13985,7 +13985,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14004,7 +14004,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID: undefined, policy: undefined, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14035,7 +14035,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: testPolicy, - userBillingGraceEndPeriodCollection: pastDueCollection, + userBillingGraceEndPeriods: pastDueCollection, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14067,7 +14067,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: testPolicy, - userBillingGraceEndPeriodCollection: pastDueCollection, + userBillingGraceEndPeriods: pastDueCollection, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: undefined, @@ -14093,7 +14093,7 @@ describe('ReportUtils', () => { icons: mockIcons, iouReportID, policy: testPolicy, - userBillingGraceEndPeriodCollection: undefined, + userBillingGraceEndPeriods: undefined, draftTransactionIDs: undefined, amountOwed: undefined, ownerBillingGraceEndPeriod: gracePeriodEnd, From 100de389d83794f5f673c8673dc99785e78e4901 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 14 Mar 2026 21:40:47 +0800 Subject: [PATCH 7/7] lint --- .../SelectionListWithSections/Search/ExpenseReportListItem.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx index 94ba6faff034d..106453b5b9338 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItem.tsx @@ -145,6 +145,7 @@ function ExpenseReportListItem({ snapshotReport, snapshotPolicy, lastPaymentMethod, + userBillingGraceEndPeriods, personalPolicyID, currentSearchKey, onDEWModalOpen,