about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/account_timeline
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/features/account_timeline')
-rw-r--r--app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx23
1 files changed, 19 insertions, 4 deletions
diff --git a/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx b/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx
index 8472d25a5..f924e7f5e 100644
--- a/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx
+++ b/app/assets/javascripts/components/features/account_timeline/containers/header_container.jsx
@@ -11,6 +11,13 @@ import {
 } from '../../../actions/accounts';
 import { mentionCompose } from '../../../actions/compose';
 import { initReport } from '../../../actions/reports';
+import { openModal } from '../../../actions/modal';
+import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
+
+const messages = defineMessages({
+  blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
+  muteConfirm: { id: 'confirmations.mute.confirm', defaultMessage: 'Mute' }
+});
 
 const makeMapStateToProps = () => {
   const getAccount = makeGetAccount();
@@ -23,7 +30,7 @@ const makeMapStateToProps = () => {
   return mapStateToProps;
 };
 
-const mapDispatchToProps = dispatch => ({
+const mapDispatchToProps = (dispatch, { intl }) => ({
   onFollow (account) {
     if (account.getIn(['relationship', 'following'])) {
       dispatch(unfollowAccount(account.get('id')));
@@ -36,7 +43,11 @@ const mapDispatchToProps = dispatch => ({
     if (account.getIn(['relationship', 'blocking'])) {
       dispatch(unblockAccount(account.get('id')));
     } else {
-      dispatch(blockAccount(account.get('id')));
+      dispatch(openModal('CONFIRM', {
+        message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
+        confirm: intl.formatMessage(messages.blockConfirm),
+        onConfirm: () => dispatch(blockAccount(account.get('id')))
+      }));
     }
   },
 
@@ -52,9 +63,13 @@ const mapDispatchToProps = dispatch => ({
     if (account.getIn(['relationship', 'muting'])) {
       dispatch(unmuteAccount(account.get('id')));
     } else {
-      dispatch(muteAccount(account.get('id')));
+      dispatch(openModal('CONFIRM', {
+        message: <FormattedMessage id='confirmations.mute.message' defaultMessage='Are you sure you want to mute {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
+        confirm: intl.formatMessage(messages.muteConfirm),
+        onConfirm: () => dispatch(muteAccount(account.get('id')))
+      }));
     }
   }
 });
 
-export default connect(makeMapStateToProps, mapDispatchToProps)(Header);
+export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header));