Skip to content
Draft
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 config/oxlint/oxlint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,6 @@
"../../src/libs/TransactionUtils/duplicates.ts" "@typescript-eslint/no-unnecessary-type-assertion" 2
"../../src/libs/TransactionUtils/duplicates.ts" "@typescript-eslint/no-unsafe-type-assertion" 4
"../../src/libs/TransactionUtils/duplicates.ts" "import/no-cycle" 2
"../../src/libs/TransactionUtils/getUpdatedTransaction.ts" "@typescript-eslint/no-deprecated/translateLocal" 1
"../../src/libs/TransactionUtils/getUpdatedTransaction.ts" "import/no-cycle" 1
"../../src/libs/TransactionUtils/index.ts" "@typescript-eslint/no-deprecated/getReportTransactions" 1
"../../src/libs/TransactionUtils/index.ts" "@typescript-eslint/no-unsafe-type-assertion" 3
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useDeleteTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
const personalPolicy = usePersonalPolicy();
const restrictedActionPolicyID = useRestrictedActionPolicyID(policy);
const {isOffline} = useNetwork();
const {formatPhoneNumber} = useLocalize();
const {formatPhoneNumber, translate} = useLocalize();

const getSplitExpenseEditTransactionOnDelete = (transactionIDs: string[]): Transaction | undefined => {
if (transactionIDs.length !== 1) {
Expand Down Expand Up @@ -293,6 +293,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
const activeGroupSearchHashes = currentSearchHash !== undefined && currentSearchHash >= 0 ? getActiveGroupSearchHashes(currentSearchResults?.data, currentSearchQueryJSON) : [];

updateSplitTransactions({
translate,
isVendorMatchingBetaEnabled,
getCurrencyDecimals,
getCurrencySymbol,
Expand Down
5 changes: 2 additions & 3 deletions src/libs/TransactionUtils/getUpdatedTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {CurrencyListActionsContextType} from '@hooks/useCurrencyList';
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
import type {CommuterExclusionData} from '@libs/DistanceRequestUtils';
import {toLocaleDigit} from '@libs/LocaleDigitUtils';
import {translateLocal} from '@libs/Localize';
import {roundToTwoDecimalPlaces} from '@libs/NumberUtils';

import CONST from '@src/CONST';
Expand Down Expand Up @@ -128,7 +127,7 @@ function getRecalculatedDistanceMerchant(
* Given the edit made to the expense, return an updated transaction object.
*/
function getUpdatedTransaction({
translate = translateLocal,
translate,
transaction,
transactionChanges,
isFromExpenseReport,
Expand All @@ -141,7 +140,7 @@ function getUpdatedTransaction({
getCurrencyDecimals,
rules,
}: {
translate?: LocaleContextProps['translate'];
translate: LocaleContextProps['translate'];
transaction: Transaction;
transactionChanges: TransactionChanges;
isFromExpenseReport: boolean;
Expand Down
5 changes: 5 additions & 0 deletions src/libs/actions/IOU/BulkEdit.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {LocaleContextProps} from '@components/LocaleContextProvider';

import type {CurrencyListActionsContextType} from '@hooks/useCurrencyList';

import * as API from '@libs/API';
Expand Down Expand Up @@ -150,6 +152,7 @@ function removeUnchangedBulkEditFields(
}

type UpdateMultipleMoneyRequestsParams = {
translate: LocaleContextProps['translate'];
transactionIDs: string[];
changes: TransactionChanges;
/** Per-level tag edits from the bulk-edit draft, keyed by tag list index. */
Expand Down Expand Up @@ -200,6 +203,7 @@ function writeBulkEditMoneyRequestAttendees(
}

function updateMultipleMoneyRequests({
translate,
transactionIDs,
changes,
bulkEditTagChanges,
Expand Down Expand Up @@ -522,6 +526,7 @@ function updateMultipleMoneyRequests({

// Build updated transaction
const updatedTransaction = getUpdatedTransaction({
translate,
transaction,
transactionChanges,
isFromExpenseReport,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/actions/IOU/SplitTransactionUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import {getUpdateMoneyRequestParams} from './UpdateMoneyRequest';

/** The splits to save and everything they are built from. The split-expenses flow takes only this and decides how the write runs itself. */
type UpdateSplitTransactionsData = {
translate: LocaleContextProps['translate'];
allTransactionsList: OnyxCollection<OnyxTypes.Transaction>;
allReportsList: OnyxCollection<OnyxTypes.Report>;
/** Draft reports, so chats that only exist in REPORT_DRAFT (e.g. a not-yet-created workspace chat) still resolve */
Expand Down Expand Up @@ -311,6 +312,7 @@ function getExpenseReportIDsEmptiedBySplitUpdate(
}

function updateSplitTransactions({
translate,
allTransactionsList,
allReportsList,
reportDrafts,
Expand Down Expand Up @@ -1137,6 +1139,7 @@ function updateSplitTransactions({
const transactionIOUReport = getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`];
const newTransactionReportID = isSelfDMSplit ? CONST.REPORT.UNREPORTED_REPORT_ID : (workspaceExpenseReportID ?? splitExpense?.reportID);
const {onyxData: moneyRequestParamsOnyxData, params} = getUpdateMoneyRequestParams({
translate,
isVendorMatchingBetaEnabled,
transactionID: existingTransactionID,
transactionThreadReport,
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU/UpdateMoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1823,8 +1823,7 @@ function updateMoneyRequestAmountAndCurrency({
}

type GetUpdateMoneyRequestParamsType = {
/** Optional until the existing-split update caller is migrated in the final PR for issue 64943. */
translate?: LocaleContextProps['translate'];
translate: LocaleContextProps['translate'];
transactionID: string | undefined;
transaction?: OnyxEntry<OnyxTypes.Transaction>;
transactionThreadReport: OnyxEntry<OnyxTypes.Report>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function SearchEditMultiplePage() {

const applyChanges = () => {
updateMultipleMoneyRequests({
translate,
isVendorMatchingBetaEnabled,
transactionIDs: selectedTransactionIDs,
changes,
Expand Down
1 change: 1 addition & 0 deletions src/pages/iou/DynamicSplitExpensePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ function DynamicSplitExpensePage({route}: DynamicSplitExpensePageProps) {
}

updateSplitTransactionsFromSplitExpensesFlow({
translate,
isVendorMatchingBetaEnabled,
getCurrencyDecimals,
getCurrencySymbol,
Expand Down
3 changes: 2 additions & 1 deletion tests/actions/IOU/SplitReportTotalsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Onyx from 'react-native-onyx';
import currencyList from '../../unit/currencyList.json';
import createMock from '../../utils/createMock';
import getOnyxValue from '../../utils/getOnyxValue';
import {getGlobalFetchMock, formatPhoneNumber, getCurrencyDecimalsLocal, getCurrencySymbolLocal} from '../../utils/TestHelper';
import {getGlobalFetchMock, formatPhoneNumber, getCurrencyDecimalsLocal, getCurrencySymbolLocal, translateLocal} from '../../utils/TestHelper';
import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates';

const topMostReportID = '23423423';
Expand Down Expand Up @@ -708,6 +708,7 @@ describe('actions/IOU', () => {

function buildBaseParams(overrides: Record<string, unknown> = {}) {
return {
translate: translateLocal,
isVendorMatchingBetaEnabled: false,
getCurrencyDecimals: getCurrencyDecimalsLocal,
getCurrencySymbol: getCurrencySymbolLocal,
Expand Down
Loading
Loading