From fe8a8f779e36e25286b6a7ddc7bcd08e2a4e2890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Reeves?= Date: Thu, 9 May 2019 22:39:27 +0200 Subject: [PATCH] Add confirm modal for unboosting toots (#10287) [#3815] Display the boost modal also when unboosting toots. --- .../mastodon/containers/status_container.js | 18 +++++++++--------- .../features/ui/components/boost_modal.js | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/containers/status_container.js b/app/javascript/mastodon/containers/status_container.js index 0fce674e20..86324b8468 100644 --- a/app/javascript/mastodon/containers/status_container.js +++ b/app/javascript/mastodon/containers/status_container.js @@ -69,18 +69,18 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onModalReblog (status) { - dispatch(reblog(status)); - }, - - onReblog (status, e) { if (status.get('reblogged')) { dispatch(unreblog(status)); } else { - if (e.shiftKey || !boostModal) { - this.onModalReblog(status); - } else { - dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog })); - } + dispatch(reblog(status)); + } + }, + + onReblog (status, e) { + if (e.shiftKey || !boostModal) { + this.onModalReblog(status); + } else { + dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog })); } }, diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.js b/app/javascript/mastodon/features/ui/components/boost_modal.js index 920e93d404..4c39a60e79 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.js +++ b/app/javascript/mastodon/features/ui/components/boost_modal.js @@ -11,6 +11,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import Icon from 'mastodon/components/icon'; const messages = defineMessages({ + cancel_reblog: { id: 'status.cancel_reblog_private', defaultMessage: 'Unboost' }, reblog: { id: 'status.reblog', defaultMessage: 'Boost' }, }); @@ -51,6 +52,7 @@ class BoostModal extends ImmutablePureComponent { render () { const { status, intl } = this.props; + const buttonText = status.get('reblogged') ? messages.cancel_reblog : messages.reblog; return (
@@ -76,7 +78,7 @@ class BoostModal extends ImmutablePureComponent {
Shift + }} />
-
);