diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js
index b8bfb4c36122..1cc12fca24ae 100755
--- a/src/components/AttachmentModal.js
+++ b/src/components/AttachmentModal.js
@@ -31,14 +31,11 @@ import useWindowDimensions from '../hooks/useWindowDimensions';
import Navigation from '../libs/Navigation/Navigation';
import ROUTES from '../ROUTES';
import useNativeDriver from '../libs/useNativeDriver';
-import * as ReportActionsUtils from '../libs/ReportActionsUtils';
import * as ReportUtils from '../libs/ReportUtils';
+import * as ReportActionsUtils from '../libs/ReportActionsUtils';
import ONYXKEYS from '../ONYXKEYS';
import * as Policy from '../libs/actions/Policy';
import useNetwork from '../hooks/useNetwork';
-import * as IOU from '../libs/actions/IOU';
-import transactionPropTypes from './transactionPropTypes';
-import * as TransactionUtils from '../libs/TransactionUtils';
/**
* Modal render prop component that exposes modal launching triggers that can be used
@@ -82,9 +79,6 @@ const propTypes = {
/** The report that has this attachment */
report: reportPropTypes,
- /** The transaction associated with the receipt attachment, if any */
- transaction: transactionPropTypes,
-
...withLocalizePropTypes,
...windowDimensionsPropTypes,
@@ -103,7 +97,6 @@ const defaultProps = {
allowDownload: false,
headerTitle: null,
report: {},
- transaction: {},
onModalShow: () => {},
onModalHide: () => {},
onCarouselAttachmentChange: () => {},
@@ -115,7 +108,6 @@ function AttachmentModal(props) {
const [isModalOpen, setIsModalOpen] = useState(props.defaultOpen);
const [shouldLoadAttachment, setShouldLoadAttachment] = useState(false);
const [isAttachmentInvalid, setIsAttachmentInvalid] = useState(false);
- const [isDeleteReceiptConfirmModalVisible, setIsDeleteReceiptConfirmModalVisible] = useState(false);
const [isAuthTokenRequired, setIsAuthTokenRequired] = useState(props.isAuthTokenRequired);
const [isAttachmentReceipt, setIsAttachmentReceipt] = useState(false);
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState('');
@@ -213,22 +205,12 @@ function AttachmentModal(props) {
}, [isModalOpen, isConfirmButtonDisabled, props.onConfirm, file, source]);
/**
- * Close the confirm modals.
+ * Close the confirm modal.
*/
const closeConfirmModal = useCallback(() => {
setIsAttachmentInvalid(false);
- setIsDeleteReceiptConfirmModalVisible(false);
}, []);
- /**
- * Detach the receipt and close the modal.
- */
- const deleteAndCloseModal = useCallback(() => {
- IOU.detachReceipt(props.transaction.transactionID, props.report.reportID);
- setIsDeleteReceiptConfirmModalVisible(false);
- Navigation.dismissModal(props.report.reportID);
- }, [props.transaction, props.report]);
-
/**
* @param {Object} _file
* @returns {Boolean}
@@ -376,18 +358,9 @@ function AttachmentModal(props) {
text: props.translate('common.download'),
onSelected: () => downloadAttachment(source),
});
- if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction)) {
- menuItems.push({
- icon: Expensicons.Trashcan,
- text: props.translate('receipt.deleteReceipt'),
- onSelected: () => {
- setIsDeleteReceiptConfirmModalVisible(true);
- },
- });
- }
return menuItems;
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isAttachmentReceipt, props.parentReport, props.parentReportActions, props.policy, props.transaction]);
+ }, [isAttachmentReceipt, props.parentReport, props.parentReportActions, props.policy]);
return (
<>
@@ -469,30 +442,18 @@ function AttachmentModal(props) {
)}
)}
- {isAttachmentReceipt ? (
-
- ) : (
-
- )}
+
+
{props.children &&
props.children({
displayFileInModal: validateAndDisplayFileToUpload,
@@ -509,16 +470,6 @@ export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
- transaction: {
- key: ({report}) => {
- if (!report) {
- return undefined;
- }
- const parentReportAction = ReportActionsUtils.getReportAction(report.parentReportID, report.parentReportActionID);
- const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], 0);
- return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
- },
- },
parentReport: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '0'}`,
},
diff --git a/src/languages/en.ts b/src/languages/en.ts
index b6f3fe877011..a221df9f4959 100755
--- a/src/languages/en.ts
+++ b/src/languages/en.ts
@@ -507,8 +507,6 @@ export default {
flash: 'flash',
shutter: 'shutter',
gallery: 'gallery',
- deleteReceipt: 'Delete receipt',
- deleteConfirmation: 'Are you sure you want to delete this receipt?',
addReceipt: 'Add receipt',
},
iou: {
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 956a9764c8f4..a8772d67c5da 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -499,8 +499,6 @@ export default {
flash: 'flash',
shutter: 'obturador',
gallery: 'galería',
- deleteReceipt: 'Eliminar recibo',
- deleteConfirmation: '¿Estás seguro de que quieres borrar este recibo?',
addReceipt: 'Añadir recibo',
},
iou: {
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index c469ed02a084..dc7206c85f76 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -2663,29 +2663,6 @@ function payMoneyRequest(paymentType, chatReport, iouReport) {
Navigation.dismissModal(chatReport.reportID);
}
-function detachReceipt(transactionID) {
- const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`] || {};
- const newTransaction = {...transaction, filename: '', receipt: {}};
-
- const optimisticData = [
- {
- onyxMethod: Onyx.METHOD.SET,
- key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
- value: newTransaction,
- },
- ];
-
- const failureData = [
- {
- onyxMethod: Onyx.METHOD.MERGE,
- key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
- value: transaction,
- },
- ];
-
- API.write('DetachReceipt', {transactionID}, {optimisticData, failureData});
-}
-
/**
* @param {String} transactionID
* @param {Object} receipt
@@ -2920,6 +2897,5 @@ export {
navigateToNextPage,
updateDistanceRequest,
replaceReceipt,
- detachReceipt,
getIOUReportID,
};