Skip to content

Commit

Permalink
remove unneded params
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonals committed Oct 4, 2023
1 parent f0d73af commit b592c3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ function AttachmentModal(props) {
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState('');
const [attachmentInvalidReason, setAttachmentInvalidReason] = useState(null);
const [source, setSource] = useState(props.source);
const [transaction] = useState(props.transaction);
const [report] = useState(props.report);
const [modalType, setModalType] = useState(CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE);
const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false);
const [confirmButtonFadeAnimation] = useState(new Animated.Value(1));
Expand Down Expand Up @@ -221,12 +219,13 @@ function AttachmentModal(props) {
}, []);

/**
* Detach the receipt and close the confirm modal.
* Detach the receipt and close the modal.
*/
const deleteAndCloseConfirmModal = useCallback(() => {
IOU.detachReceipt(transaction.transactionID, report.reportID);
const deleteAndCloseModal = useCallback(() => {
IOU.detachReceipt(props.transaction.transactionID, props.report.reportID);
setIsDeleteReceiptConfirmModalVisible(false);
}, [transaction, report]);
Navigation.dismissModal(props.report.reportID);
}, [props.transaction, props.report]);

/**
* @param {Object} _file
Expand Down Expand Up @@ -459,7 +458,7 @@ function AttachmentModal(props) {
<ConfirmModal
title={translate('receipt.deleteReceipt')}
isVisible={isDeleteReceiptConfirmModalVisible}
onConfirm={deleteAndCloseConfirmModal}
onConfirm={deleteAndCloseModal}
onCancel={closeConfirmModal}
prompt={translate('receipt.deleteConfirmation')}
confirmText={translate('common.delete')}
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,7 @@ function payMoneyRequest(paymentType, chatReport, iouReport) {
Navigation.dismissModal(chatReport.reportID);
}

function detachReceipt(transactionID, reportID) {
function detachReceipt(transactionID) {
const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`] || {};
const newTransaction = {...transaction, filename: '', receipt: {}};

Expand All @@ -2135,7 +2135,6 @@ function detachReceipt(transactionID, reportID) {
];

API.write('DetachReceipt', {transactionID}, {optimisticData, failureData});
Navigation.dismissModal(reportID);
}

/**
Expand Down

0 comments on commit b592c3c

Please sign in to comment.