diff --git a/app/soapbox/containers/status_container.js b/app/soapbox/containers/status_container.js index 0b812e033..cbb00e84d 100644 --- a/app/soapbox/containers/status_container.js +++ b/app/soapbox/containers/status_container.js @@ -145,7 +145,7 @@ const mapDispatchToProps = (dispatch, { intl }) => { } else { dispatch(openModal('CONFIRM', { icon: withRedraft ? require('@tabler/icons/icons/edit.svg') : require('@tabler/icons/icons/trash.svg'), - heading: intl.formatMessage(withRedraft ? messages.redraftHeading : messages.deleteHeading), + heading: intl.formatMessage(withRedraft ? messages.redraftHeading : messages.deleteHeading), message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage), confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm), onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)), diff --git a/app/soapbox/features/scheduled_statuses/components/scheduled_status_action_bar.js b/app/soapbox/features/scheduled_statuses/components/scheduled_status_action_bar.js index f505eeacd..76ecbc9bd 100644 --- a/app/soapbox/features/scheduled_statuses/components/scheduled_status_action_bar.js +++ b/app/soapbox/features/scheduled_statuses/components/scheduled_status_action_bar.js @@ -6,10 +6,15 @@ import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types'; import IconButton from 'soapbox/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import { openModal } from 'soapbox/actions/modal'; import { cancelScheduledStatus } from 'soapbox/actions/scheduled_statuses'; +import { getSettings } from 'soapbox/actions/settings'; const messages = defineMessages({ cancel: { id: 'scheduled_status.cancel', defaultMessage: 'Cancel' }, + deleteConfirm: { id: 'confirmations.scheduled_status_delete.confirm', defaultMessage: 'Cancel' }, + deleteHeading: { id: 'confirmations.scheduled_status_delete.heading', defaultMessage: 'Cancel scheduled post' }, + deleteMessage: { id: 'confirmations.scheduled_status_delete.message', defaultMessage: 'Are you sure you want to cancel this scheduled post?' }, }); const mapStateToProps = state => { @@ -19,8 +24,26 @@ const mapStateToProps = state => { }; }; -export default @connect(mapStateToProps, null, null, { forwardRef: true }) -@injectIntl +const mapDispatchToProps = (dispatch, { intl }) => ({ + onCancelClick: (status) => { + dispatch((_, getState) => { + + const deleteModal = getSettings(getState()).get('deleteModal'); + if (!deleteModal) { + dispatch(cancelScheduledStatus(status.get('id'))); + } else { + dispatch(openModal('CONFIRM', { + icon: require('@tabler/icons/icons/trash.svg'), + heading: intl.formatMessage(messages.deleteHeading), + message: intl.formatMessage(messages.deleteMessage), + confirm: intl.formatMessage(messages.deleteConfirm), + onConfirm: () => dispatch(cancelScheduledStatus(status.get('id'))), + })); + } + }); + }, +}); + class ScheduledStatusActionBar extends ImmutablePureComponent { static contextTypes = { @@ -31,11 +54,13 @@ class ScheduledStatusActionBar extends ImmutablePureComponent { status: ImmutablePropTypes.map.isRequired, intl: PropTypes.object.isRequired, me: SoapboxPropTypes.me, + onCancelClick: PropTypes.func.isRequired, }; handleCancelClick = e => { - const { status, dispatch } = this.props; - dispatch(cancelScheduledStatus(status.get('id'))); + const { status, onCancelClick } = this.props; + + onCancelClick(status); } render() { @@ -56,3 +81,6 @@ class ScheduledStatusActionBar extends ImmutablePureComponent { } } + + +export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ScheduledStatusActionBar)); diff --git a/app/soapbox/locales/pl.json b/app/soapbox/locales/pl.json index a0f63e0ad..848bcbfe5 100644 --- a/app/soapbox/locales/pl.json +++ b/app/soapbox/locales/pl.json @@ -302,6 +302,9 @@ "confirmations.register.needs_confirmation": "Sprawdź swoją skrzynkę na {email}, aby znaleźć instrukcje potwierdzania. Musisz zweryfikować swój adres e-mail, aby kontynuować.", "confirmations.reply.confirm": "Odpowiedz", "confirmations.reply.message": "W ten sposób utracisz wpis który obecnie tworzysz. Czy na pewno chcesz to zrobić?", + "confirmations.scheduled_status_delete.confirm": "Anuluj", + "confirmations.scheduled_status_delete.heading": "Anuluj zaplanowany wpis", + "confirmations.scheduled_status_delete.message": "Czy na pewno chcesz anulować ten zaplanowany wpis?", "confirmations.unfollow.confirm": "Przestań śledzić", "confirmations.unfollow.message": "Czy na pewno zamierzasz przestać śledzić {name}?", "crypto_donate.explanation_box.message": "{siteTitle} przyjmuje darowizny w kryptowalutach. Możesz wysłać darowiznę na jeden z poniższych adresów. Dziękujemy za Wasze wsparcie!",