Skip to content

Commit

Permalink
optimistically remove the hold violation
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Jul 17, 2024
1 parent 10d04a8 commit b74a6b1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7060,6 +7060,7 @@ function putOnHold(transactionID: string, comment: string, reportID: string) {
*/
function unholdRequest(transactionID: string, reportID: string) {
const createdReportAction = ReportUtils.buildOptimisticUnHoldReportAction();
const transactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`];

const optimisticData: OnyxUpdate[] = [
{
Expand All @@ -7079,6 +7080,11 @@ function unholdRequest(transactionID: string, reportID: string) {
},
},
},
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
value: transactionViolations?.filter((violation) => violation.name !== CONST.VIOLATIONS.HOLD) ?? [],
},
];

const successData: OnyxUpdate[] = [
Expand All @@ -7103,6 +7109,11 @@ function unholdRequest(transactionID: string, reportID: string) {
errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericUnholdExpenseFailureMessage'),
},
},
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
value: transactionViolations ?? null,
},
];

API.write(
Expand Down

0 comments on commit b74a6b1

Please sign in to comment.