Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] Copy category over from expense when Editing a Money Request #27055

Merged
merged 8 commits into from
Sep 13, 2023
3 changes: 3 additions & 0 deletions src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ function getUpdatedTransaction(transaction, transactionChanges, isFromExpenseRep
updatedTransaction.receipt.state = CONST.IOU.RECEIPT_STATE.OPEN;
}

// Always copy over the category for now until we have a way to edit it (Will be implemented in https://github.com/Expensify/App/issues/24464)
updatedTransaction.category = transaction.category;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this... required, we clone the original transaction at the start of this method so that would be included.

What we have to do is to add it as a param to the edit money request call and create a new getter for it and return it in the getTransactionDetails

App/src/libs/actions/IOU.js

Lines 1058 to 1071 in 67df8e9

const {created, amount, currency, comment, merchant} = ReportUtils.getTransactionDetails(updatedTransaction);
API.write(
'EditMoneyRequest',
{
transactionID,
reportActionID: updatedReportAction.reportActionID,
created,
amount,
currency,
comment,
merchant,
},
{optimisticData, successData, failureData},
);


updatedTransaction.pendingFields = {
...(_.has(transactionChanges, 'comment') && {comment: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}),
...(_.has(transactionChanges, 'created') && {created: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}),
Expand Down
Loading