Skip to content

Commit

Permalink
fix: remove unnecessary condition
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Feb 9, 2024
1 parent 084a25c commit 23e79b9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 17 deletions.
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
55 changes: 40 additions & 15 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -3671,7 +3691,12 @@ function navigateToNextPage(iou: OnyxEntry<OnyxTypes.IOU>, 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();
}
Expand Down

0 comments on commit 23e79b9

Please sign in to comment.