From 921d7c1935c366eb170b8db5a2dc5a7c5e5e9df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 11 Jun 2022 23:36:40 +0200 Subject: [PATCH] Change confirmation modal for edited posts 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 | 8 +++++--- app/soapbox/locales/pl.json | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/soapbox/components/modal_root.js b/app/soapbox/components/modal_root.js index 1c4c53224..5acedae29 100644 --- a/app/soapbox/components/modal_root.js +++ b/app/soapbox/components/modal_root.js @@ -27,6 +27,7 @@ const checkComposeContent = compose => { const mapStateToProps = state => ({ hasComposeContent: checkComposeContent(state.get('compose')), + isEditing: state.compose.get('id') !== null, }); const mapDispatchToProps = (dispatch) => ({ @@ -53,6 +54,7 @@ class ModalRoot extends React.PureComponent { onCancelReplyCompose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, hasComposeContent: PropTypes.bool, + isEditing: PropTypes.bool, type: PropTypes.string, onCancel: PropTypes.func, history: PropTypes.object, @@ -72,13 +74,13 @@ class ModalRoot extends React.PureComponent { } handleOnClose = () => { - const { onOpenModal, onCloseModal, hasComposeContent, intl, type, onCancelReplyCompose } = this.props; + const { onOpenModal, onCloseModal, hasComposeContent, isEditing, intl, type, onCancelReplyCompose } = this.props; if (hasComposeContent && type === 'COMPOSE') { onOpenModal('CONFIRM', { icon: require('@tabler/icons/icons/trash.svg'), - heading: , - message: , + heading: isEditing ? : , + message: isEditing ? : , confirm: intl.formatMessage(messages.confirm), onConfirm: () => onCancelReplyCompose(), onCancel: () => onCloseModal('CONFIRM'), diff --git a/app/soapbox/locales/pl.json b/app/soapbox/locales/pl.json index ac557b58d..7740949f5 100644 --- a/app/soapbox/locales/pl.json +++ b/app/soapbox/locales/pl.json @@ -325,6 +325,8 @@ "confirmations.block.confirm": "Zablokuj", "confirmations.block.heading": "Zablokuj @{name}", "confirmations.block.message": "Czy na pewno chcesz zablokować {name}?", + "confirmations.cancel_editing.heading": "Anuluj edycję wpisu", + "confirmations.cancel_editing.message": "Czy na pewno chcesz anulować edytowanie wpisu? Niezapisane zmiany zostaną utracone.", "confirmations.delete.confirm": "Usuń", "confirmations.delete.heading": "Usuń wpis", "confirmations.delete.message": "Czy na pewno chcesz usunąć ten wpis?",