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
13 changes: 13 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11188,6 +11188,18 @@ function updateLastLocationPermissionPrompt() {
Onyx.set(ONYXKEYS.NVP_LAST_LOCATION_PERMISSION_PROMPT, new Date().toISOString());
}

function setMultipleMoneyRequestParticipantsFromReport(transactionIDs: string[], reportValue: OnyxEntry<OnyxTypes.Report>) {
const participants = getMoneyRequestParticipantsFromReport(reportValue);
const updatedTransactions: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${string}`, NullishDeep<OnyxTypes.Transaction>> = {};
transactionIDs.forEach((transactionID) => {
updatedTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`] = {
participants,
participantsAutoAssigned: true,
};
});
return Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, updatedTransactions);
}

/** Instead of merging the duplicates, it updates the transaction we want to keep and puts the others on hold without deleting them */
function resolveDuplicates(params: MergeDuplicatesParams) {
if (!params.transactionID) {
Expand Down Expand Up @@ -11892,6 +11904,7 @@ export {
setMoneyRequestParticipantsFromReport,
getMoneyRequestParticipantsFromReport,
setMoneyRequestPendingFields,
setMultipleMoneyRequestParticipantsFromReport,
setMoneyRequestReceipt,
setMoneyRequestTag,
setMoneyRequestTaxAmount,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/iou/request/step/IOURequestStepScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import {
setMoneyRequestParticipants,
setMoneyRequestParticipantsFromReport,
setMoneyRequestReceipt,
setMultipleMoneyRequestParticipantsFromReport,
startSplitBill,
trackExpense,
updateLastLocationPermissionPrompt,
Expand Down Expand Up @@ -497,9 +498,8 @@ function IOURequestStepScan({
createTransaction(files, participant);
return;
}

const setParticipantsPromises = files.map((receiptFile) => setMoneyRequestParticipantsFromReport(receiptFile.transactionID, report));
Promise.all(setParticipantsPromises).then(() => navigateToConfirmationPage());
const transactionIDs = files.map((receiptFile) => receiptFile.transactionID);
setMultipleMoneyRequestParticipantsFromReport(transactionIDs, report).then(() => navigateToConfirmationPage());
return;
}

Expand Down