Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6532,7 +6532,6 @@ const CONST = {
HOLD: 'hold',
UNHOLD: 'unhold',
DELETE: 'delete',
REJECT: 'reject',
CHANGE_REPORT: 'changeReport',
},
TRANSACTION_TYPE: {
Expand Down
1 change: 0 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ const ROUTES = {
},
},
TRANSACTION_HOLD_REASON_RHP: 'search/hold',
SEARCH_REJECT_REASON_RHP: 'search/reject',
MOVE_TRANSACTIONS_SEARCH_RHP: 'search/move-transactions',

// This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated
Expand Down
2 changes: 0 additions & 2 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const SCREENS = {
ROOT: 'Search_Root',
MONEY_REQUEST_REPORT: 'Search_Money_Request_Report',
MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS: 'Search_Money_Request_Report_Hold_Transactions',
MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS: 'Search_Money_Request_Report_Reject_Transactions',
REPORT_RHP: 'Search_Report_RHP',
ADVANCED_FILTERS_RHP: 'Search_Advanced_Filters_RHP',
ADVANCED_FILTERS_TYPE_RHP: 'Search_Advanced_Filters_Type_RHP',
Expand Down Expand Up @@ -88,7 +87,6 @@ const SCREENS = {
SAVED_SEARCH_RENAME_RHP: 'Search_Saved_Search_Rename_RHP',
ADVANCED_FILTERS_IN_RHP: 'Search_Advanced_Filters_In_RHP',
TRANSACTION_HOLD_REASON_RHP: 'Search_Transaction_Hold_Reason_RHP',
SEARCH_REJECT_REASON_RHP: 'Search_Reject_Reason_RHP',
TRANSACTIONS_CHANGE_REPORT_SEARCH_RHP: 'Search_Transactions_Change_Report_RHP',
},
SETTINGS: {
Expand Down
1 change: 0 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6251,7 +6251,6 @@ ${amount} für ${merchant} - ${date}`,
delete: 'Löschen',
hold: 'Halten',
unhold: 'Halten entfernen',
reject: 'Ablehnen',
noOptionsAvailable: 'Keine Optionen verfügbar für die ausgewählte Gruppe von Ausgaben.',
},
filtersHeader: 'Filter',
Expand Down
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6213,7 +6213,6 @@ const translations = {
delete: 'Delete',
hold: 'Hold',
unhold: 'Remove hold',
reject: 'Reject',
noOptionsAvailable: 'No options available for the selected group of expenses.',
},
filtersHeader: 'Filters',
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6236,7 +6236,6 @@ ${amount} para ${merchant} - ${date}`,
delete: 'Eliminar',
hold: 'Retener',
unhold: 'Desbloquear',
reject: 'Rechazar',
noOptionsAvailable: 'No hay opciones disponibles para el grupo de gastos seleccionado.',
},
filtersHeader: 'Filtros',
Expand Down
1 change: 0 additions & 1 deletion src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6256,7 +6256,6 @@ ${amount} pour ${merchant} - ${date}`,
delete: 'Supprimer',
hold: 'Attente',
unhold: 'Supprimer la suspension',
reject: 'Refuser',
noOptionsAvailable: 'Aucune option disponible pour le groupe de dépenses sélectionné.',
},
filtersHeader: 'Filtres',
Expand Down
1 change: 0 additions & 1 deletion src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6262,7 +6262,6 @@ ${amount} per ${merchant} - ${date}`,
delete: 'Elimina',
hold: 'Attendere',
unhold: 'Rimuovi blocco',
reject: 'Rifiuta',
noOptionsAvailable: 'Nessuna opzione disponibile per il gruppo di spese selezionato.',
},
filtersHeader: 'Filtri',
Expand Down
1 change: 0 additions & 1 deletion src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6198,7 +6198,6 @@ ${date} - ${merchant}に${amount}`,
delete: '削除',
hold: '保留',
unhold: '保留を解除',
reject: '却下',
noOptionsAvailable: '選択した経費グループには利用可能なオプションがありません。',
},
filtersHeader: 'フィルター',
Expand Down
1 change: 0 additions & 1 deletion src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6247,7 +6247,6 @@ ${amount} voor ${merchant} - ${date}`,
delete: 'Verwijderen',
hold: 'Vasthouden',
unhold: 'Verwijder blokkering',
reject: 'Afwijzen',
noOptionsAvailable: 'Geen opties beschikbaar voor de geselecteerde groep uitgaven.',
},
filtersHeader: 'Filters',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6234,7 +6234,6 @@ ${amount} dla ${merchant} - ${date}`,
delete: 'Usuń',
hold: 'Trzymaj',
unhold: 'Usuń blokadę',
reject: 'Odrzuć',
noOptionsAvailable: 'Brak dostępnych opcji dla wybranej grupy wydatków.',
},
filtersHeader: 'Filtry',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6242,7 +6242,6 @@ ${amount} para ${merchant} - ${date}`,
delete: 'Excluir',
hold: 'Manter',
unhold: 'Remover retenção',
reject: 'Rejeitar',
noOptionsAvailable: 'Nenhuma opção disponível para o grupo de despesas selecionado.',
},
filtersHeader: 'Filtros',
Expand Down
1 change: 0 additions & 1 deletion src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6119,7 +6119,6 @@ ${merchant}的${amount} - ${date}`,
delete: '删除',
hold: '保持',
unhold: '移除保留',
reject: '拒绝',
noOptionsAvailable: '所选费用组没有可用选项。',
},
filtersHeader: '筛选器',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ const OPTIONS_PER_SCREEN: Partial<Record<Screen, PlatformStackNavigationOptions>
[SCREENS.SEARCH.MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS]: {
animation: Animations.NONE,
},
[SCREENS.SEARCH.MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS]: {
animation: Animations.NONE,
},
[SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP]: {
animation: Animations.NONE,
},
[SCREENS.SEARCH.SEARCH_REJECT_REASON_RHP]: {
animation: Animations.NONE,
},
[SCREENS.SEARCH.TRANSACTIONS_CHANGE_REPORT_SEARCH_RHP]: {
animation: Animations.NONE,
},
Expand Down Expand Up @@ -837,9 +831,7 @@ const MergeTransactionStackNavigator = createModalStackNavigator<MergeTransactio
const SearchReportModalStackNavigator = createModalStackNavigator<SearchReportParamList>({
[SCREENS.SEARCH.REPORT_RHP]: () => require<ReactComponentModule>('../../../../pages/home/ReportScreen').default,
[SCREENS.SEARCH.MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS]: () => require<ReactComponentModule>('../../../../pages/Search/SearchHoldReasonPage').default,
[SCREENS.SEARCH.MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS]: () => require<ReactComponentModule>('../../../../pages/Search/SearchRejectReasonPage').default,
[SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchHoldReasonPage').default,
[SCREENS.SEARCH.SEARCH_REJECT_REASON_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchRejectReasonPage').default,
[SCREENS.SEARCH.TRANSACTIONS_CHANGE_REPORT_SEARCH_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchTransactionsChangeReport').default,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const SEARCH_TO_RHP: Partial<Record<keyof SearchFullscreenNavigatorParamList, st
SCREENS.SEARCH.ADVANCED_FILTERS_STATUS_RHP,
SCREENS.SEARCH.REPORT_RHP,
SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP,
SCREENS.SEARCH.SEARCH_REJECT_REASON_RHP,
SCREENS.SEARCH.TRANSACTIONS_CHANGE_REPORT_SEARCH_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_CURRENCY_RHP,
Expand Down
1 change: 0 additions & 1 deletion src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.SEARCH.REPORT_RHP]: ROUTES.SEARCH_REPORT.route,
[SCREENS.SEARCH.MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS]: ROUTES.SEARCH_MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS.route,
[SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP]: ROUTES.TRANSACTION_HOLD_REASON_RHP,
[SCREENS.SEARCH.SEARCH_REJECT_REASON_RHP]: ROUTES.SEARCH_REJECT_REASON_RHP,
[SCREENS.SEARCH.TRANSACTIONS_CHANGE_REPORT_SEARCH_RHP]: ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP,
},
},
Expand Down
5 changes: 0 additions & 5 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2557,11 +2557,6 @@ type SearchReportParamList = {
/** Selected transactions' report ID */
reportID: string;
};
[SCREENS.SEARCH.SEARCH_REJECT_REASON_RHP]: Record<string, never>;
[SCREENS.SEARCH.MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS]: {
/** Selected transactions' report ID */
reportID: string;
};
};

type SearchFullscreenNavigatorParamList = {
Expand Down
55 changes: 4 additions & 51 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 699 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -773,13 +773,13 @@
};

let allBetas: OnyxEntry<OnyxTypes.Beta[]>;
Onyx.connect({

Check warning on line 776 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 782 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -793,7 +793,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 796 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -802,7 +802,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 805 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -816,7 +816,7 @@
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStep>> = {};
Onyx.connect({

Check warning on line 819 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -825,14 +825,14 @@
});

let allPolicyCategories: OnyxCollection<OnyxTypes.PolicyCategories> = {};
Onyx.connect({

Check warning on line 828 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_CATEGORIES,
waitForCollectionCallback: true,
callback: (val) => (allPolicyCategories = val),
});

const allPolicies: OnyxCollection<OnyxTypes.Policy> = {};
Onyx.connect({

Check warning on line 835 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (val, key) => {
if (!key) {
Expand Down Expand Up @@ -868,14 +868,14 @@
// `allRecentlyUsedTags` was moved here temporarily from `src/libs/actions/Policy/Tag.ts` during the `Deprecate Onyx.connect` refactor.
// All uses of this variable should be replaced with `useOnyx`.
let allRecentlyUsedTags: OnyxCollection<RecentlyUsedTags> = {};
Onyx.connect({

Check warning on line 871 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS,
waitForCollectionCallback: true,
callback: (val) => (allRecentlyUsedTags = val),
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 878 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -12735,11 +12735,9 @@
* @param transactionID - The ID of the transaction to reject
* @param reportID - The ID of the expense report to reject
* @param comment - The comment to add to the reject action
* @param options
* - sharedRejectedToReportID: When rejecting multiple expenses sequentially, pass a single shared destination reportID so all rejections land in the same new report.
* @returns The route to navigate back to*
* @returns The route to navigate back to
*/
function rejectMoneyRequest(transactionID: string, reportID: string, comment: string, options?: {sharedRejectedToReportID?: string}): Route | undefined {
function rejectMoneyRequest(transactionID: string, reportID: string, comment: string): Route | undefined {
const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
const transactionAmount = getAmount(transaction);
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
Expand All @@ -12759,7 +12757,7 @@
const childReportID = reportAction?.childReportID;

let movedToReport;
let rejectedToReportID = options?.sharedRejectedToReportID;
let rejectedToReportID;
let urlToNavigateBack;

const hasMultipleExpenses = getReportTransactions(reportID).length > 1;
Expand Down Expand Up @@ -12966,10 +12964,7 @@
},
});
} else {
// When no existing open report is found, use the sharedRejectedToReportID
// so multiple sequential rejections land in the same destination report
// Fallback to generating a fresh ID if not provided
rejectedToReportID = rejectedToReportID ?? generateReportID();
rejectedToReportID = generateReportID();
}
optimisticData.push(
{
Expand Down Expand Up @@ -13186,48 +13181,6 @@
});
});

// Add snapshot updates if called from the Reports page
const currentSearchQueryJSON = getCurrentSearchQueryJSON();
if (currentSearchQueryJSON?.hash) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}`,
value: {
data: {
[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {
isActionLoading: true,
errors: null,
},
},
},
});

successData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}`,
value: {
data: {
[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {
isActionLoading: false,
},
},
},
});

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}`,
value: {
data: {
[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {
isActionLoading: false,
errors: getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'),
},
},
},
});
}

// Build API parameters
const parameters: RejectMoneyRequestParams = {
transactionID,
Expand Down
26 changes: 0 additions & 26 deletions src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import type {OptimisticExportIntegrationAction} from '@libs/ReportUtils';
import {
buildOptimisticExportIntegrationAction,
buildOptimisticIOUReportAction,
generateReportID,
getReportTransactions,
hasHeldExpenses,
isExpenseReport,
Expand All @@ -48,7 +47,6 @@ import type {SearchPolicy, SearchReport, SearchTransaction} from '@src/types/ony
import type Nullable from '@src/types/utils/Nullable';
import SafeString from '@src/utils/SafeString';
import {setPersonalBankAccountContinueKYCOnSuccess} from './BankAccounts';
import {rejectMoneyRequest} from './IOU';
import {setOptimisticTransactionThread} from './Report';
import {saveLastSearchParams} from './ReportNavigation';

Expand Down Expand Up @@ -582,29 +580,6 @@ function unholdMoneyRequestOnSearch(hash: number, transactionIDList: string[]) {
API.write(WRITE_COMMANDS.UNHOLD_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, finallyData});
}

function rejectMoneyRequestsOnSearch(hash: number, selectedTransactions: SelectedTransactions, comment: string) {
const transactionIDs = Object.keys(selectedTransactions);

const transactionsByReport: Record<string, string[]> = {};
transactionIDs.forEach((transactionID) => {
const reportID = selectedTransactions[transactionID].reportID;
if (!transactionsByReport[reportID]) {
transactionsByReport[reportID] = [];
}
transactionsByReport[reportID].push(transactionID);
});

Object.entries(transactionsByReport).forEach(([reportID, reportTransactionIDs]) => {
// Share a single destination ID across all rejections from the same source report
const sharedRejectedToReportID = generateReportID();
reportTransactionIDs.forEach((transactionID) => {
rejectMoneyRequest(transactionID, reportID, comment, {sharedRejectedToReportID});
});
});

playSound(SOUNDS.SUCCESS);
}

function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) {
const {optimisticData: loadingOptimisticData, finallyData} = getOnyxLoadingData(hash);
const optimisticData: OnyxUpdate[] = [
Expand Down Expand Up @@ -981,7 +956,6 @@ export {
deleteMoneyRequestOnSearch,
holdMoneyRequestOnSearch,
unholdMoneyRequestOnSearch,
rejectMoneyRequestsOnSearch,
exportSearchItemsToCSV,
queueExportSearchItemsToCSV,
queueExportSearchWithTemplate,
Expand Down
13 changes: 7 additions & 6 deletions src/pages/Search/SearchHoldReasonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import SCREENS from '@src/SCREENS';
import INPUT_IDS from '@src/types/form/MoneyRequestHoldReasonForm';

type SearchHoldReasonPageProps =
| PlatformStackScreenProps<SearchReportParamList, typeof SCREENS.SEARCH.MONEY_REQUEST_REPORT_HOLD_TRANSACTIONS>
| PlatformStackScreenProps<SearchReportParamList, typeof SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP>;

function SearchHoldReasonPage({route}: SearchHoldReasonPageProps) {
function SearchHoldReasonPage({route}: PlatformStackScreenProps<Omit<SearchReportParamList, typeof SCREENS.SEARCH.REPORT_RHP>>) {
const {translate} = useLocalize();
const {backTo = '', reportID} = route.params ?? {};
const context = useSearchContext();
Expand All @@ -44,6 +40,11 @@ function SearchHoldReasonPage({route}: SearchHoldReasonPageProps) {
const validate = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.MONEY_REQUEST_HOLD_FORM>) => {
const errors: FormInputErrors<typeof ONYXKEYS.FORMS.MONEY_REQUEST_HOLD_FORM> = getFieldRequiredErrors(values, [INPUT_IDS.COMMENT]);

if (!values.comment) {
errors.comment = translate('common.error.fieldRequired');
}

return errors;
},
[translate],
Expand All @@ -58,7 +59,7 @@ function SearchHoldReasonPage({route}: SearchHoldReasonPageProps) {
<HoldReasonFormView
onSubmit={onSubmit}
validate={validate}
backTo={backTo ?? ''}
backTo={backTo}
/>
);
}
Expand Down
40 changes: 1 addition & 39 deletions src/pages/Search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,7 @@
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {SearchFullscreenNavigatorParamList} from '@libs/Navigation/types';
import {getActiveAdminWorkspaces, hasDynamicExternalWorkflow, hasVBBA, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {
canRejectReportAction,
generateReportID,
getPolicyExpenseChat,
getReportOrDraftReport,
isExpenseReport as isExpenseReportUtil,
isIOUReport as isIOUReportUtil,
} from '@libs/ReportUtils';
import {generateReportID, getPolicyExpenseChat, getReportOrDraftReport, isExpenseReport as isExpenseReportUtil, isIOUReport as isIOUReportUtil} from '@libs/ReportUtils';
import {buildCannedSearchQuery, buildSearchQueryJSON} from '@libs/SearchQueryUtils';
import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils';
import type {ReceiptFile} from '@pages/iou/request/step/IOURequestStepScan/types';
Expand Down Expand Up @@ -262,9 +255,7 @@
) as PaymentData[];

payMoneyRequestOnSearch(hash, paymentData, transactionIDList);

// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {

Check failure on line 258 in src/pages/Search/SearchPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`runAfterInteractions` is deprecated
clearSelectedTransactions();
});
},
Expand Down Expand Up @@ -406,35 +397,6 @@
},
});
}

const areSelectedTransactionsRejectable =
selectedTransactionReportIDs.length > 0 &&
selectedTransactionReportIDs.every((id) => {
const report = getReportOrDraftReport(id);
if (!report) {
return false;
}
const policyForReport = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`] ?? undefined;
return canRejectReportAction(currentUserPersonalDetails?.login ?? '', report, policyForReport);
});
const shouldShowRejectOption = !isOffline && !isAnyTransactionOnHold && areSelectedTransactionsRejectable;
if (shouldShowRejectOption) {
options.push({
icon: Expensicons.ThumbsDown,
text: translate('search.bulkActions.reject'),
value: CONST.SEARCH.BULK_ACTION_TYPES.REJECT,
shouldCloseModalOnSelect: true,
onSelected: () => {
if (isOffline) {
setIsOfflineModalVisible(true);
return;
}

Navigation.navigate(ROUTES.SEARCH_REJECT_REASON_RHP);
},
});
}

const shouldEnableExpenseBulk = selectedReports.length
? selectedReports.every(
(report) => report.allActions.includes(CONST.SEARCH.ACTION_TYPES.PAY) && report.policyID && getLastPolicyPaymentMethod(report.policyID, lastPaymentMethods),
Expand Down
Loading
Loading