Skip to content

Commit

Permalink
Merge pull request #29524 from ishpaul777/fix/Confirm-Modal-for-large…
Browse files Browse the repository at this point in the history
…-attachements

fixes: invalid file modal and delete option shown for setted IOU
  • Loading branch information
jasperhuangg authored Oct 13, 2023
2 parents a7d1c2c + 5ad3372 commit 5b35a3c
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ function AttachmentModal(props) {
text: props.translate('common.download'),
onSelected: () => downloadAttachment(source),
});
if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction)) {
if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction) && !isSettled) {
menuItems.push({
icon: Expensicons.Trashcan,
text: props.translate('receipt.deleteReceipt'),
Expand Down Expand Up @@ -469,7 +469,7 @@ function AttachmentModal(props) {
)}
</SafeAreaConsumer>
)}
{isAttachmentReceipt ? (
{isAttachmentReceipt && (
<ConfirmModal
title={translate('receipt.deleteReceipt')}
isVisible={isDeleteReceiptConfirmModalVisible}
Expand All @@ -480,18 +480,19 @@ function AttachmentModal(props) {
cancelText={translate('common.cancel')}
danger
/>
) : (
<ConfirmModal
title={attachmentInvalidReasonTitle ? translate(attachmentInvalidReasonTitle) : ''}
onConfirm={closeConfirmModal}
onCancel={closeConfirmModal}
isVisible={isAttachmentInvalid}
prompt={attachmentInvalidReason ? translate(attachmentInvalidReason) : ''}
confirmText={translate('common.close')}
shouldShowCancelButton={false}
/>
)}
</Modal>
{!isAttachmentReceipt && (
<ConfirmModal
title={attachmentInvalidReasonTitle ? translate(attachmentInvalidReasonTitle) : ''}
onConfirm={closeConfirmModal}
onCancel={closeConfirmModal}
isVisible={isAttachmentInvalid}
prompt={attachmentInvalidReason ? translate(attachmentInvalidReason) : ''}
confirmText={translate('common.close')}
shouldShowCancelButton={false}
/>
)}

{props.children &&
props.children({
Expand Down

0 comments on commit 5b35a3c

Please sign in to comment.