Skip to content

Commit

Permalink
fix: report header has "Hold" action when the expense is already in H…
Browse files Browse the repository at this point in the history
…old status
  • Loading branch information
daledah committed Oct 8, 2024
1 parent 41c0b9d commit 63511d6
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8348,9 +8348,30 @@ function resolveDuplicates(params: TransactionMergeParams) {
const optimisticHoldActions: OnyxUpdate[] = [];
const failureHoldActions: OnyxUpdate[] = [];
const reportActionIDList: string[] = [];
const optimisticHoldTransactionActions: OnyxUpdate[] = [];
const failureHoldTransactionActions: OnyxUpdate[] = [];
transactionThreadReportIDList.forEach((transactionThreadReportID) => {
const createdReportAction = ReportUtils.buildOptimisticHoldReportAction();
reportActionIDList.push(createdReportAction.reportActionID);
const transactionID = TransactionUtils.getTransactionID(transactionThreadReportID ?? '-1');
optimisticHoldTransactionActions.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: {
comment: {
hold: createdReportAction.reportActionID,
},
},
});
failureHoldTransactionActions.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: {
comment: {
hold: null,
},
},
});
optimisticHoldActions.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`,
Expand Down Expand Up @@ -8394,8 +8415,8 @@ function resolveDuplicates(params: TransactionMergeParams) {
const optimisticData: OnyxUpdate[] = [];
const failureData: OnyxUpdate[] = [];

optimisticData.push(optimisticTransactionData, ...optimisticTransactionViolations, ...optimisticHoldActions, optimisticReportActionData);
failureData.push(failureTransactionData, ...failureTransactionViolations, ...failureHoldActions, failureReportActionData);
optimisticData.push(optimisticTransactionData, ...optimisticTransactionViolations, ...optimisticHoldActions, ...optimisticHoldTransactionActions, optimisticReportActionData);
failureData.push(failureTransactionData, ...failureTransactionViolations, ...failureHoldActions, ...failureHoldTransactionActions, failureReportActionData);
const {reportID, transactionIDList, receiptID, ...otherParams} = params;

const parameters: ResolveDuplicatesParams = {
Expand Down

0 comments on commit 63511d6

Please sign in to comment.