Skip to content

Commit

Permalink
Merge pull request Expensify#34328 from tienifr/fix/33940
Browse files Browse the repository at this point in the history
Fix: Only visible to you does not disappear when edit an amount field of scan IOU
  • Loading branch information
AndrewGable authored Jan 15, 2024
2 parents e85c339 + bb8555a commit 978b39f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t
const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
const iouReport = allReports[`${ONYXKEYS.COLLECTION.REPORT}${transactionThread.parentReportID}`];
const isFromExpenseReport = ReportUtils.isExpenseReport(iouReport);
const isScanning = TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);
const updatedTransaction = TransactionUtils.getUpdatedTransaction(transaction, transactionChanges, isFromExpenseReport);
const transactionDetails = ReportUtils.getTransactionDetails(updatedTransaction);

Expand Down Expand Up @@ -1030,6 +1031,30 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t
},
});

if (isScanning && (_.has(transactionChanges, 'amount') || _.has(transactionChanges, 'currency'))) {
optimisticData.push(
...[
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`,
value: {
[transactionThread.parentReportActionID]: {
whisperedToAccountIDs: [],
},
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.parentReportID}`,
value: {
[iouReport.parentReportActionID]: {
whisperedToAccountIDs: [],
},
},
},
],
);
}
// Update recently used categories if the category is changed
if (_.has(transactionChanges, 'category')) {
const optimisticPolicyRecentlyUsedCategories = Policy.buildOptimisticPolicyRecentlyUsedCategories(iouReport.policyID, transactionChanges.category);
Expand Down

0 comments on commit 978b39f

Please sign in to comment.