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
4 changes: 0 additions & 4 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,6 @@ const CONST = {
MAX_COUNT_BEFORE_FOCUS_UPDATE: 30,
MIN_INITIAL_REPORT_ACTION_COUNT: 15,
UNREPORTED_REPORT_ID: '0',
TRASH_REPORT_ID: '-1',
SPLIT_REPORT_ID: '-2',
SECONDARY_ACTIONS: {
SUBMIT: 'submit',
Expand Down Expand Up @@ -7379,7 +7378,6 @@ const CONST = {
DONE: 'done',
EXPORT_TO_ACCOUNTING: 'exportToAccounting',
PAID: 'paid',
UNDELETE: 'undelete',
},
HAS_VALUES: {
RECEIPT: 'receipt',
Expand All @@ -7401,7 +7399,6 @@ const CONST = {
REJECT: 'reject',
CHANGE_REPORT: 'changeReport',
SPLIT: 'split',
UNDELETE: 'undelete',
},
TRANSACTION_TYPE: {
CASH: 'cash',
Expand Down Expand Up @@ -7636,7 +7633,6 @@ const CONST = {
APPROVED: 'approved',
DONE: 'done',
PAID: 'paid',
DELETED: 'deleted',
},
EXPENSE_REPORT: {
ALL: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const actionTranslationsMap: Record<SearchTransactionAction, TranslationPaths> =
[CONST.SEARCH.ACTION_TYPES.EXPORT_TO_ACCOUNTING]: 'common.export',
[CONST.SEARCH.ACTION_TYPES.DONE]: 'common.done',
[CONST.SEARCH.ACTION_TYPES.PAID]: 'iou.settledExpensify',
[CONST.SEARCH.ACTION_TYPES.UNDELETE]: 'search.bulkActions.undelete',
};

export default actionTranslationsMap;
11 changes: 4 additions & 7 deletions src/components/Search/SearchList/ListItem/StatusCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useMemo} from 'react';
import {View} from 'react-native';
import StatusBadge from '@components/StatusBadge';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -15,18 +15,15 @@ type StatusCellProps = {

/** Whether the report's state/status is pending */
isPending?: boolean;

/** Whether the transaction was deleted */
isDeleted?: boolean;
};

function StatusCell({stateNum, statusNum, isPending, isDeleted}: StatusCellProps) {
function StatusCell({stateNum, statusNum, isPending}: StatusCellProps) {
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();

const statusText = getReportStatusTranslation({stateNum, statusNum, isDeleted, translate});
const reportStatusColorStyle = getReportStatusColorStyle(theme, stateNum, statusNum, isDeleted);
const statusText = useMemo(() => getReportStatusTranslation({stateNum, statusNum, translate}), [stateNum, statusNum, translate]);
const reportStatusColorStyle = useMemo(() => getReportStatusColorStyle(theme, stateNum, statusNum), [theme, stateNum, statusNum]);

if (!statusText || !reportStatusColorStyle) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {handleActionButtonPress as handleActionButtonPressUtil} from '@libs/acti
import {syncMissingAttendeesViolation} from '@libs/AttendeeUtils';
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import {isInvoiceReport} from '@libs/ReportUtils';
import {isDeletedTransaction as isDeletedTransactionUtil, isViolationDismissed, mergeProhibitedViolations, shouldShowViolation} from '@libs/TransactionUtils';
import {isViolationDismissed, mergeProhibitedViolations, shouldShowViolation} from '@libs/TransactionUtils';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -51,10 +51,8 @@ function TransactionListItem<TItem extends ListItem>({
customCardNames,
lastPaymentMethod,
personalPolicyID,
onUndelete,
}: TransactionListItemProps<TItem>) {
const transactionItem = item as unknown as TransactionListItemType;
const isDeletedTransaction = isDeletedTransactionUtil(transactionItem);
const styles = useThemeStyles();
const theme = useTheme();

Expand Down Expand Up @@ -167,7 +165,6 @@ function TransactionListItem<TItem extends ListItem>({
onDelegateAccessRestricted: showDelegateNoAccessModal,
personalPolicyID,
ownerBillingGracePeriodEnd,
onUndelete: () => onUndelete?.(transactionItem.transactionID),
});
};

Expand All @@ -181,10 +178,10 @@ function TransactionListItem<TItem extends ListItem>({
<PressableWithFeedback
ref={pressableRef}
onLongPress={() => onLongPressRow?.(item)}
onPress={isDeletedTransaction ? undefined : () => onSelectRow(item, transactionPreviewData)}
onPress={() => onSelectRow(item, transactionPreviewData)}
disabled={isDisabled && !item.isSelected}
accessibilityLabel={item.text ?? ''}
role={isDeletedTransaction ? getButtonRole(true) : 'none'}
role={getButtonRole(true)}
isNested
onMouseDown={(e) => e.preventDefault()}
hoverStyle={[!item.isDisabled && styles.hoveredComponentBG, item.isSelected && styles.activeComponentBG]}
Expand All @@ -194,7 +191,6 @@ function TransactionListItem<TItem extends ListItem>({
style={[
pressableStyle,
isFocused && StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
isDeletedTransaction && styles.cursorDefault,
]}
onFocus={onFocus}
wrapperStyle={[styles.mb2, styles.mh5, styles.flex1, animatedHighlightStyle, styles.userSelectNone]}
Expand All @@ -205,7 +201,7 @@ function TransactionListItem<TItem extends ListItem>({
<UserInfoAndActionButtonRow
item={transactionItem}
handleActionButtonPress={handleActionButtonPress}
shouldShowUserInfo={!isDeletedTransaction && !!transactionItem?.from}
shouldShowUserInfo={!!transactionItem?.from}
isInMobileSelectionMode={shouldUseNarrowLayout && !!canSelectMultiple}
isDisabledItem={!!isDisabled}
/>
Expand Down Expand Up @@ -233,7 +229,7 @@ function TransactionListItem<TItem extends ListItem>({
checkboxSentryLabel={CONST.SENTRY_LABEL.SEARCH.TRANSACTION_LIST_ITEM_CHECKBOX}
style={[styles.p3, styles.pv2, shouldUseNarrowLayout ? styles.pt2 : {}]}
violations={transactionViolations}
onArrowRightPress={isDeletedTransaction ? undefined : () => onSelectRow(item, transactionPreviewData)}
onArrowRightPress={() => onSelectRow(item, transactionPreviewData)}
isHover={hovered}
customCardNames={customCardNames}
reportActions={exportedReportActions}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Search/SearchList/ListItem/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ type TransactionListItemProps<TItem extends ListItem> = ListItemProps<TItem> & {
lastPaymentMethod?: OnyxEntry<LastPaymentMethod>;
/** The user's personal policy ID */
personalPolicyID?: string;
/** Callback to undelete a transaction by its ID */
onUndelete?: (transactionID: string) => void;
};

type TransactionGroupListItemProps<TItem extends ListItem> = ListItemProps<TItem> & {
Expand Down
6 changes: 0 additions & 6 deletions src/components/Search/SearchList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import usePrevious from '@hooks/usePrevious';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaPaddings from '@hooks/useSafeAreaPaddings';
import useThemeStyles from '@hooks/useThemeStyles';
import useUndeleteTransactions from '@hooks/useUndeleteTransactions';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {turnOnMobileSelectionMode} from '@libs/actions/MobileSelectionMode';
import DateUtils from '@libs/DateUtils';
Expand Down Expand Up @@ -302,9 +301,6 @@ function SearchList({
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
const [lastPaymentMethod] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD);
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID);
const undeleteTransactions = useUndeleteTransactions();

const handleUndelete = (transactionID: string) => undeleteTransactions([transactionID]);

const route = useRoute();
const {getScrollOffset} = useContext(ScrollOffsetContext);
Expand Down Expand Up @@ -454,7 +450,6 @@ function SearchList({
customCardNames={customCardNames}
onFocus={onFocus}
newTransactionID={newTransactionID}
onUndelete={handleUndelete}
keyForList={item.keyForList}
/>
</Animated.View>
Expand Down Expand Up @@ -487,7 +482,6 @@ function SearchList({
personalPolicyID,
customCardNames,
selectedTransactions,
handleUndelete,
],
);

Expand Down
3 changes: 0 additions & 3 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
getCreated as getTransactionCreated,
hasMissingSmartscanFields,
isAmountMissing,
isDeletedTransaction as isDeletedTransactionUtil,
isMerchantMissing,
isScanning,
isTimeRequest,
Expand Down Expand Up @@ -204,7 +203,6 @@ function TransactionItemRow({
const createdAt = getTransactionCreated(transactionItem);
const expensicons = useMemoizedLazyExpensifyIcons(['ArrowRight']);
const transactionThreadReportID = reportActions ? getIOUActionForTransactionID(reportActions, transactionItem.transactionID)?.childReportID : undefined;
const isDeletedTransaction = isDeletedTransactionUtil(transactionItem);

const isDateColumnWide = dateColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const isSubmittedColumnWide = submittedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
Expand Down Expand Up @@ -617,7 +615,6 @@ function TransactionItemRow({
<StatusCell
stateNum={transactionItem.report?.stateNum}
statusNum={transactionItem.report?.statusNum}
isDeleted={isDeletedTransaction}
/>
</View>
);
Expand Down
25 changes: 1 addition & 24 deletions src/hooks/useSearchBulkActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
import {serializeQueryJSONForBackend} from '@libs/SearchQueryUtils';
import {navigateToSearchRHP, shouldShowDeleteOption} from '@libs/SearchUIUtils';
import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils';
import {hasTransactionBeenRejected, isDeletedTransaction} from '@libs/TransactionUtils';
import {hasTransactionBeenRejected} from '@libs/TransactionUtils';
import variables from '@styles/variables';
import {canIOUBePaid, dismissRejectUseExplanation, initBulkEditDraftTransaction} from '@userActions/IOU';
import CONST from '@src/CONST';
Expand All @@ -72,7 +72,6 @@ import usePersonalPolicy from './usePersonalPolicy';
import useSelfDMReport from './useSelfDMReport';
import useTheme from './useTheme';
import useThemeStyles from './useThemeStyles';
import useUndeleteTransactions from './useUndeleteTransactions';

type SearchHeaderOptionValue = DeepValueOf<typeof CONST.SEARCH.BULK_ACTION_TYPES> | undefined;

Expand Down Expand Up @@ -125,7 +124,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const {isBetaEnabled} = usePermissions();
const [ownerBillingGracePeriodEnd] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const undeleteTransactions = useUndeleteTransactions();

// Cache the last search results that had data, so the merge option remains available
// while results are temporarily unset (e.g. during sorting/loading).
Expand Down Expand Up @@ -167,7 +165,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
'Exclamation',
'MoneyBag',
'ArrowSplit',
'RotateLeft',
'QBOSquare',
'XeroSquare',
'NetSuiteSquare',
Expand Down Expand Up @@ -735,23 +732,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
return CONST.EMPTY_ARRAY as unknown as Array<DropdownOption<SearchHeaderOptionValue>>;
}

const allSelectedAreDeleted = selectedTransactionsKeys.length > 0 && selectedTransactionsKeys.every((id) => isDeletedTransaction(selectedTransactions[id] ?? {}));

if (allSelectedAreDeleted) {
return [
{
icon: expensifyIcons.RotateLeft,
text: translate('search.bulkActions.undelete'),
value: CONST.SEARCH.BULK_ACTION_TYPES.UNDELETE,
shouldCloseModalOnSelect: true,
onSelected: () => {
undeleteTransactions(selectedTransactionsKeys);
clearSelectedTransactions();
},
},
];
}

const options: Array<DropdownOption<SearchHeaderOptionValue>> = [];
const isAnyTransactionOnHold = Object.values(selectedTransactions).some((transaction) => transaction.isHeld);

Expand Down Expand Up @@ -1250,7 +1230,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
expensifyIcons.ArrowSplit,
expensifyIcons.Pencil,
expensifyIcons.Trashcan,
expensifyIcons.RotateLeft,
expensifyIcons.Exclamation,
translate,
areAllMatchingItemsSelected,
Expand Down Expand Up @@ -1294,8 +1273,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
firstTransaction,
firstTransactionPolicy,
handleDeleteSelectedTransactions,
undeleteTransactions,
currentUserPersonalDetails?.email,
theme.icon,
styles.colorMuted,
styles.fontWeightNormal,
Expand Down
33 changes: 0 additions & 33 deletions src/hooks/useUndeleteTransactions.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,6 @@ const translations: TranslationDeepObject<typeof en> = {
failedToApproveViaDEW: (reason: string) => `Genehmigung fehlgeschlagen. ${reason}`,
cannotDuplicateDistanceExpense:
'Sie können Entfernungsausgaben nicht über mehrere Arbeitsbereiche hinweg duplizieren, da sich die Sätze zwischen den Arbeitsbereichen unterscheiden können.',
deleted: 'Gelöscht',
},
transactionMerge: {
listPage: {
Expand Down Expand Up @@ -7413,7 +7412,6 @@ Fordern Sie Spesendetails wie Belege und Beschreibungen an, legen Sie Limits und
unhold: 'Zurückhalten aufheben',
reject: 'Ablehnen',
noOptionsAvailable: 'Für die ausgewählte Ausgabengruppe sind keine Optionen verfügbar.',
undelete: 'Wiederherstellen',
},
filtersHeader: 'Filter',
filters: {
Expand Down
2 changes: 0 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,6 @@ const translations = {
}),
settledExpensify: 'Paid',
done: 'Done',
deleted: 'Deleted',
settledElsewhere: 'Paid elsewhere',
individual: 'Individual',
business: 'Business',
Expand Down Expand Up @@ -7408,7 +7407,6 @@ const translations = {
hold: 'Hold',
unhold: 'Remove hold',
reject: 'Reject',
undelete: 'Undelete',
noOptionsAvailable: 'No options available for the selected group of expenses.',
},
filtersHeader: 'Filters',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,6 @@ const translations: TranslationDeepObject<typeof en> = {
}),
settledExpensify: 'Pagado',
done: 'Listo',
deleted: 'Eliminado',
settledElsewhere: 'Pagado de otra forma',
individual: 'Individual',
business: 'Empresa',
Expand Down Expand Up @@ -7310,7 +7309,6 @@ ${amount} para ${merchant} - ${date}`,
hold: 'Retener',
unhold: 'Desbloquear',
reject: 'Rechazar',
undelete: 'Restaurar',
noOptionsAvailable: 'No hay opciones disponibles para el grupo de gastos seleccionado.',
},
filtersHeader: 'Filtros',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,6 @@ const translations: TranslationDeepObject<typeof en> = {
`impossible d’approuver via les <a href="${CONST.CONFIGURE_EXPENSE_REPORT_RULES_HELP_URL}">règles de l’espace de travail</a>. ${reason}`,
failedToApproveViaDEW: (reason: string) => `échec de l’approbation. ${reason}`,
cannotDuplicateDistanceExpense: 'Vous ne pouvez pas dupliquer des dépenses de distance entre espaces de travail, car les taux peuvent différer d’un espace de travail à l’autre.',
deleted: 'Supprimé',
},
transactionMerge: {
listPage: {
Expand Down Expand Up @@ -7436,7 +7435,6 @@ Rendez obligatoires des informations de dépense comme les reçus et les descrip
unhold: 'Supprimer la mise en attente',
reject: 'Rejeter',
noOptionsAvailable: 'Aucune option n’est disponible pour le groupe de dépenses sélectionné.',
undelete: 'Restaurer',
},
filtersHeader: 'Filtres',
filters: {
Expand Down
2 changes: 0 additions & 2 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,6 @@ const translations: TranslationDeepObject<typeof en> = {
`approvazione non riuscita tramite le <a href="${CONST.CONFIGURE_EXPENSE_REPORT_RULES_HELP_URL}">regole dello spazio di lavoro</a>. ${reason}`,
failedToApproveViaDEW: (reason: string) => `approvazione non riuscita. ${reason}`,
cannotDuplicateDistanceExpense: 'Non puoi duplicare le spese chilometriche tra diversi spazi di lavoro perché le tariffe potrebbero essere diverse.',
deleted: 'Eliminato',
},
transactionMerge: {
listPage: {
Expand Down Expand Up @@ -7403,7 +7402,6 @@ Richiedi dettagli sulle spese come ricevute e descrizioni, imposta limiti e valo
unhold: 'Rimuovi blocco',
reject: 'Rifiuta',
noOptionsAvailable: 'Nessuna opzione disponibile per il gruppo di spese selezionato.',
undelete: 'Ripristina',
},
filtersHeader: 'Filtri',
filters: {
Expand Down
Loading
Loading