Skip to content

Commit 924ac1d

Browse files
authored
Merge pull request #85465 from Expensify/cmartins-rmDeleteOnSerch
Remove DeleteMoneyRequestOnSearch
2 parents 72baaed + d4e7da5 commit 924ac1d

9 files changed

Lines changed: 45 additions & 1222 deletions

File tree

src/components/Search/SearchBulkActionsButton.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import useOnyx from '@hooks/useOnyx';
1515
import usePolicy from '@hooks/usePolicy';
1616
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1717
import useSearchBulkActions from '@hooks/useSearchBulkActions';
18-
import useSearchDeleteTransactions from '@hooks/useSearchDeleteTransactions';
1918
import useSortedActiveAdminPolicies from '@hooks/useSortedActiveAdminPolicies';
2019
import useThemeStyles from '@hooks/useThemeStyles';
2120
import {handleBulkPayItemSelected} from '@libs/actions/Search';
@@ -47,7 +46,6 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
4746
const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
4847
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector});
4948
const activeAdminPolicies = useSortedActiveAdminPolicies();
50-
const {deleteTransactionsOnSearch} = useSearchDeleteTransactions();
5149
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
5250

5351
const {
@@ -66,7 +64,7 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
6664
handleDownloadErrorModalClose,
6765
dismissModalAndUpdateUseHold,
6866
dismissRejectModalBasedOnAction,
69-
} = useSearchBulkActions({queryJSON, deleteTransactionsOnSearch});
67+
} = useSearchBulkActions({queryJSON});
7068

7169
const currentSelectedPolicyID = selectedPolicyIDs?.at(0);
7270
const currentSelectedReportID = selectedTransactionReportIDs?.at(0) ?? selectedReportIDs?.at(0);

src/hooks/useSearchBulkActions.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ import useThemeStyles from './useThemeStyles';
7272

7373
type UseSearchBulkActionsParams = {
7474
queryJSON: SearchQueryJSON | undefined;
75-
deleteTransactionsOnSearch?: (hash: number, transactionIDs: string[], transactions?: OnyxCollection<Transaction>) => void;
7675
};
7776

7877
function getRestrictedPolicyID(items: Array<{policyID?: string}>, billingGracePeriods: OnyxCollection<BillingGraceEndPeriod>): string | undefined {
7978
return items.map((item) => item.policyID).find((policyID): policyID is string => !!policyID && shouldRestrictUserBillableActions(policyID, billingGracePeriods));
8079
}
8180

82-
function useSearchBulkActions({queryJSON, deleteTransactionsOnSearch}: UseSearchBulkActionsParams) {
81+
function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
8382
const {translate, localeCompare, formatPhoneNumber, toLocaleDigit} = useLocalize();
8483
const styles = useThemeStyles();
8584
const theme = useTheme();
@@ -92,6 +91,7 @@ function useSearchBulkActions({queryJSON, deleteTransactionsOnSearch}: UseSearch
9291
const {accountID} = currentUserPersonalDetails;
9392
const allTransactions = useAllTransactions();
9493
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
94+
const [allReportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS);
9595
const selfDMReport = useSelfDMReport();
9696
const [lastPaymentMethods] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD);
9797
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID);
@@ -501,7 +501,6 @@ function useSearchBulkActions({queryJSON, deleteTransactionsOnSearch}: UseSearch
501501
bulkDeleteReports({
502502
reports: allReports,
503503
selfDMReport,
504-
hash,
505504
selectedTransactions,
506505
currentUserEmailParam: currentUserPersonalDetails.email ?? '',
507506
currentUserAccountIDParam: accountID,
@@ -512,7 +511,7 @@ function useSearchBulkActions({queryJSON, deleteTransactionsOnSearch}: UseSearch
512511
translate,
513512
toLocaleDigit,
514513
transactions,
515-
deleteTransactionsOnSearch,
514+
allReportNameValuePairs,
516515
});
517516
}
518517
clearSelectedTransactions();
@@ -539,7 +538,7 @@ function useSearchBulkActions({queryJSON, deleteTransactionsOnSearch}: UseSearch
539538
toLocaleDigit,
540539
isExpenseReportType,
541540
selectedReportIDs,
542-
deleteTransactionsOnSearch,
541+
allReportNameValuePairs,
543542
]);
544543

545544
const onBulkPaySelected = useCallback(

src/hooks/useSearchDeleteTransactions.ts

Lines changed: 0 additions & 180 deletions
This file was deleted.

src/libs/API/parameters/DeleteMoneyRequestOnSearchParams.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/libs/API/parameters/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ export type {default as ReportExportParams} from './ReportExportParams';
301301
export type {default as MarkAsExportedParams} from './MarkAsExportedParams';
302302
export type {default as UpgradeToCorporateParams} from './UpgradeToCorporateParams';
303303
export type {default as DowngradeToTeamParams} from './DowngradeToTeamParams';
304-
export type {default as DeleteMoneyRequestOnSearchParams} from './DeleteMoneyRequestOnSearchParams';
305304
export type {default as RejectMoneyRequestInBulkParams} from './RejectMoneyRequestInBulkParams';
306305
export type {default as HoldMoneyRequestOnSearchParams} from './HoldMoneyRequestOnSearchParams';
307306
export type {default as ApproveMoneyRequestOnSearchParams} from './ApproveMoneyRequestOnSearchParams';

src/libs/API/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ const WRITE_COMMANDS = {
374374
MARK_AS_EXPORTED: 'MarkAsExported',
375375
UPGRADE_TO_CORPORATE: 'UpgradeToCorporate',
376376
DOWNGRADE_TO_TEAM: 'Policy_DowngradeToTeam',
377-
DELETE_MONEY_REQUEST_ON_SEARCH: 'DeleteMoneyRequestOnSearch',
378377
REJECT_MONEY_REQUEST_IN_BULK: 'RejectMoneyRequestInBulk',
379378
HOLD_MONEY_REQUEST_ON_SEARCH: 'HoldMoneyRequestOnSearch',
380379
APPROVE_MONEY_REQUEST_ON_SEARCH: 'ApproveMoneyRequestOnSearch',
@@ -971,7 +970,6 @@ type WriteCommandParameters = {
971970
[WRITE_COMMANDS.REOPEN_REPORT]: Parameters.ReopenReportParams;
972971
[WRITE_COMMANDS.SEND_SCHEDULE_CALL_NUDGE]: Parameters.SendScheduleCallNudgeParams;
973972

974-
[WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH]: Parameters.DeleteMoneyRequestOnSearchParams;
975973
[WRITE_COMMANDS.REJECT_MONEY_REQUEST_IN_BULK]: Parameters.RejectMoneyRequestInBulkParams;
976974
[WRITE_COMMANDS.HOLD_MONEY_REQUEST_ON_SEARCH]: Parameters.HoldMoneyRequestOnSearchParams;
977975
[WRITE_COMMANDS.APPROVE_MONEY_REQUEST_ON_SEARCH]: Parameters.ApproveMoneyRequestOnSearchParams;

0 commit comments

Comments
 (0)