From 05d296f1ee488f391de1e4446cb9911c035ecdd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 30 Aug 2022 22:51:13 +0200 Subject: [PATCH] Consistent behavior of compose modal close confirmation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/components/modal_root.js | Bin 7199 -> 7144 bytes .../features/ui/components/compose_modal.tsx | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/soapbox/components/modal_root.js b/app/soapbox/components/modal_root.js index bf7ecd2c6219348e58c1bf44344b904bbd2c645a..6c6c4021e0f6eb7dca7767b4c833bad10bfdb5f2 100644 GIT binary patch delta 24 fcmbPl@xpwA2@`v2ML~X1iNa(Prd69|n3*L3a!m*a delta 65 zcmaE1KHp-43Dab2rd0-+dGST51v!=RCHV@9wzdj+r8zk|Tna#toS$2eU!1B}Sejpw M3YXh_ok>s<0P~F&6#xJL diff --git a/app/soapbox/features/ui/components/compose_modal.tsx b/app/soapbox/features/ui/components/compose_modal.tsx index 81a8c92545..de53442e34 100644 --- a/app/soapbox/features/ui/components/compose_modal.tsx +++ b/app/soapbox/features/ui/components/compose_modal.tsx @@ -3,6 +3,7 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { cancelReplyCompose } from 'soapbox/actions/compose'; import { openModal, closeModal } from 'soapbox/actions/modals'; +import { checkComposeContent } from 'soapbox/components/modal_root'; import { Modal } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; @@ -23,13 +24,13 @@ const ComposeModal: React.FC = ({ onClose }) => { const dispatch = useAppDispatch(); const statusId = useAppSelector((state) => state.compose.id); - const composeText = useAppSelector((state) => state.compose.text); + const hasComposeContent = useAppSelector((state) => checkComposeContent(state.compose)); const privacy = useAppSelector((state) => state.compose.privacy); const inReplyTo = useAppSelector((state) => state.compose.in_reply_to); const quote = useAppSelector((state) => state.compose.quote); const onClickClose = () => { - if (composeText) { + if (hasComposeContent) { dispatch(openModal('CONFIRM', { icon: require('@tabler/icons/trash.svg'), heading: statusId