From 23e79b9f57836f81c0396a8af2ed7cafa93adc8f Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 9 Feb 2024 11:32:34 +0000 Subject: [PATCH] fix: remove unnecessary condition --- ios/Podfile.lock | 4 +-- src/libs/actions/IOU.ts | 55 ++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1664c982ce50..534fd6bb30c8 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1981,8 +1981,8 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 VisionCamera: fda554d8751e395effcc87749f8b7c198c1031be - Yoga: 13c8ef87792450193e117976337b8527b49e8c03 + Yoga: e64aa65de36c0832d04e8c7bd614396c77a80047 PODFILE CHECKSUM: 0ccbb4f2406893c6e9f266dc1e7470dcd72885d2 -COCOAPODS: 1.13.0 +COCOAPODS: 1.12.1 diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index edf849c35bc8..7d669bc736eb 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -261,7 +261,11 @@ function clearMoneyRequest(transactionID: string) { // eslint-disable-next-line @typescript-eslint/naming-convention function setMoneyRequestAmount_temporaryForRefactor(transactionID: string, amount: number, currency: string, removeOriginalCurrency = false) { if (removeOriginalCurrency) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount, currency, originalCurrency: null}); + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, { + amount, + currency, + originalCurrency: null, + }); return; } Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount, currency}); @@ -357,7 +361,11 @@ function resetMoneyRequestInfo(id = '') { function getReceiptError(receipt?: Receipt, filename?: string, isScanRequest = true): Errors | ErrorFields { return isEmptyObject(receipt) || !isScanRequest ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') - : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: receipt.source?.toString() ?? '', filename: filename ?? ''}); + : ErrorUtils.getMicroSecondOnyxErrorObject({ + error: CONST.IOU.RECEIPT_ERROR, + source: receipt.source?.toString() ?? '', + filename: filename ?? '', + }); } /** Return the object to update hasOutstandingChildRequest */ @@ -1205,14 +1213,12 @@ function getUpdateMoneyRequestParams( }); } - if (transactionThread) { - // Reset the transaction thread to its original state - failureData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, - value: transactionThread, - }); - } + // Reset the transaction thread to its original state + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, + value: transactionThread, + }); return { params, @@ -1565,7 +1571,13 @@ function createSplitsAndOnyxData( // Loop through participants creating individual chats, iouReports and reportActionIDs as needed const splitAmount = IOUUtils.calculateAmount(participants.length, amount, currency, false); - const splits: Split[] = [{email: currentUserEmailForIOUSplit, accountID: currentUserAccountID, amount: IOUUtils.calculateAmount(participants.length, amount, currency, true)}]; + const splits: Split[] = [ + { + email: currentUserEmailForIOUSplit, + accountID: currentUserAccountID, + amount: IOUUtils.calculateAmount(participants.length, amount, currency, true), + }, + ]; const hasMultipleParticipants = participants.length > 1; participants.forEach((participant) => { @@ -3581,9 +3593,17 @@ function setMoneyRequestParticipantsFromReport(transactionID: string, report: On const currentUserAccountID = currentUserPersonalDetails.accountID; const participants: Participant[] = ReportUtils.isPolicyExpenseChat(chatReport) ? [{reportID: chatReport?.reportID, isPolicyExpenseChat: true, selected: true}] - : (chatReport?.participantAccountIDs ?? []).filter((accountID) => currentUserAccountID !== accountID).map((accountID) => ({accountID, selected: true})); - - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {participants, participantsAutoAssigned: true}); + : (chatReport?.participantAccountIDs ?? []) + .filter((accountID) => currentUserAccountID !== accountID) + .map((accountID) => ({ + accountID, + selected: true, + })); + + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, { + participants, + participantsAutoAssigned: true, + }); } /** Initialize money request info and navigate to the MoneyRequest page */ @@ -3671,7 +3691,12 @@ function navigateToNextPage(iou: OnyxEntry, iouType: string, repo const currentUserAccountID = currentUserPersonalDetails.accountID; const participants: Participant[] = ReportUtils.isPolicyExpenseChat(chatReport) ? [{reportID: chatReport?.reportID, isPolicyExpenseChat: true, selected: true}] - : (chatReport?.participantAccountIDs ?? []).filter((accountID) => currentUserAccountID !== accountID).map((accountID) => ({accountID, selected: true})); + : (chatReport?.participantAccountIDs ?? []) + .filter((accountID) => currentUserAccountID !== accountID) + .map((accountID) => ({ + accountID, + selected: true, + })); setMoneyRequestParticipants(participants); resetMoneyRequestCategory(); }