Skip to content

Commit 63b1a3a

Browse files
authored
Merge pull request #87997 from hungvu193/fix-664420-part6
2 parents 8151a35 + 5f08273 commit 63b1a3a

7 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/pages/Search/EmptySearchView.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,13 @@ function EmptySearchViewContent({
333333
if (
334334
!workspaceIDForReportCreation ||
335335
(defaultChatEnabledPolicy &&
336-
shouldRestrictUserBillableActions(defaultChatEnabledPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed) &&
336+
shouldRestrictUserBillableActions(
337+
defaultChatEnabledPolicy,
338+
ownerBillingGracePeriodEnd,
339+
userBillingGracePeriodEnds,
340+
amountOwed,
341+
accountID,
342+
) &&
337343
groupPoliciesWithChatEnabled.length > 1)
338344
) {
339345
// If we couldn't guess the workspace to create the report, or a guessed workspace is past it's grace period and we have other workspaces to choose from
@@ -343,7 +349,13 @@ function EmptySearchViewContent({
343349

344350
if (
345351
!defaultChatEnabledPolicy ||
346-
!shouldRestrictUserBillableActions(defaultChatEnabledPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)
352+
!shouldRestrictUserBillableActions(
353+
defaultChatEnabledPolicy,
354+
ownerBillingGracePeriodEnd,
355+
userBillingGracePeriodEnds,
356+
amountOwed,
357+
accountID,
358+
)
347359
) {
348360
handleCreateReportClick();
349361
} else {

src/pages/Search/SearchTransactionsChangeReport.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function SearchTransactionsChangeReport() {
169169
if (
170170
policyForMovingExpensesID &&
171171
policyForMovingExpenses &&
172-
shouldRestrictUserBillableActions(policyForMovingExpenses, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)
172+
shouldRestrictUserBillableActions(policyForMovingExpenses, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, session?.accountID)
173173
) {
174174
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policyForMovingExpensesID));
175175
return;

src/pages/inbox/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ function AttachmentPickerWithMenuItems({
185185
shouldRestrictAction &&
186186
policy &&
187187
policy.type !== CONST.POLICY.TYPE.PERSONAL &&
188-
shouldRestrictUserBillableActions(policy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)
188+
shouldRestrictUserBillableActions(policy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, accountID)
189189
) {
190190
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id));
191191
return;
192192
}
193193

194194
onSelected();
195195
},
196-
[policy, userBillingGracePeriodEnds, ownerBillingGracePeriodEnd, amountOwed],
196+
[policy, userBillingGracePeriodEnds, ownerBillingGracePeriodEnd, amountOwed, accountID],
197197
);
198198

199199
const {openCreateReportConfirmation} = useCreateEmptyReportConfirmation({

src/pages/inbox/report/ReportActionCompose/useReceiptDrop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function useReceiptDrop({reportID, report, shouldAddOrReplaceReceipt, transactio
8888
const {validateFiles, PDFValidationComponent, ErrorModal} = useFilesValidation(onFilesValidated);
8989

9090
const onReceiptDropped = (e: DragEvent) => {
91-
if (policy && shouldRestrictUserBillableActions(policy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
91+
if (policy && shouldRestrictUserBillableActions(policy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, currentUserPersonalDetails.accountID)) {
9292
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id));
9393
return;
9494
}

src/pages/inbox/sidebar/FABPopoverContent/menuItems/QuickActionMenuItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function QuickActionMenuItem({reportID}: QuickActionMenuItemProps) {
118118
shouldRestrictAction &&
119119
quickActionReportPolicyID &&
120120
quickActionReportPolicy &&
121-
shouldRestrictUserBillableActions(quickActionReportPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)
121+
shouldRestrictUserBillableActions(quickActionReportPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, session?.accountID)
122122
) {
123123
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(quickActionReportPolicyID));
124124
return;
@@ -197,7 +197,7 @@ function QuickActionMenuItem({reportID}: QuickActionMenuItemProps) {
197197
if (
198198
policyChatForActivePolicyPolicyID &&
199199
policyChatForActivePolicyPolicy &&
200-
shouldRestrictUserBillableActions(policyChatForActivePolicyPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)
200+
shouldRestrictUserBillableActions(policyChatForActivePolicyPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, session?.accountID)
201201
) {
202202
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policyChatForActivePolicyPolicyID));
203203
return;

src/pages/iou/request/step/BaseRequestStepWorkspace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function BaseRequestStepWorkspace({transaction, getPolicies, onSelectWorkspace}:
8282
const selectWorkspace = (item: WorkspaceListItem) => {
8383
const policyID = item.policyID;
8484
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`];
85-
if (shouldRestrictUserBillableActions(policy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, currentUserAccountID)) {
85+
if (shouldRestrictUserBillableActions(policy ?? policyID, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, currentUserAccountID)) {
8686
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policyID));
8787
return;
8888
}

src/pages/iou/request/step/IOURequestEditReport.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function IOURequestEditReport({route}: IOURequestEditReportProps) {
146146

147147
const createReport = () => {
148148
const restrictionPolicy = hasPerDiemTransactions ? selectedReportPolicy : policyForMovingExpenses;
149-
if (restrictionPolicy && shouldRestrictUserBillableActions(restrictionPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed)) {
149+
if (restrictionPolicy && shouldRestrictUserBillableActions(restrictionPolicy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, session?.accountID)) {
150150
Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(restrictionPolicy.id));
151151
return;
152152
}

0 commit comments

Comments
 (0)