Skip to content

Commit

Permalink
Merge pull request #50383 from daledah/fix/49872
Browse files Browse the repository at this point in the history
fix: report header has "Hold" action when the expense is already in Hold status
  • Loading branch information
jasperhuangg authored Oct 21, 2024
2 parents 786d037 + 63511d6 commit 9ba6c4b
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 @@ -8410,9 +8410,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 @@ -8456,8 +8477,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 9ba6c4b

Please sign in to comment.