From 70e9dd0b5b2c4b2d695334d8b63c6d58cb1619d8 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 3 Oct 2016 18:49:52 +0200 Subject: Blocking will prevent e-mail notifications from blocked user, blocks in UI --- .../features/account/components/action_bar.jsx | 38 +++++++++++++++++----- .../components/features/account/index.jsx | 12 ++++++- 2 files changed, 41 insertions(+), 9 deletions(-) (limited to 'app/assets/javascripts/components/features') diff --git a/app/assets/javascripts/components/features/account/components/action_bar.jsx b/app/assets/javascripts/components/features/account/components/action_bar.jsx index 309471dd2..aadf168b2 100644 --- a/app/assets/javascripts/components/features/account/components/action_bar.jsx +++ b/app/assets/javascripts/components/features/account/components/action_bar.jsx @@ -7,7 +7,8 @@ const ActionBar = React.createClass({ propTypes: { account: ImmutablePropTypes.map.isRequired, me: React.PropTypes.number.isRequired, - onFollow: React.PropTypes.func.isRequired + onFollow: React.PropTypes.func.isRequired, + onBlock: React.PropTypes.func.isRequired }, mixins: [PureRenderMixin], @@ -16,25 +17,46 @@ const ActionBar = React.createClass({ const { account, me } = this.props; let infoText = ''; + let follow = ''; let buttonText = ''; + let block = ''; + let disabled = false; if (account.get('id') === me) { buttonText = 'This is you!'; + disabled = true; } else { - if (account.getIn(['relationship', 'following'])) { - buttonText = 'Unfollow'; + let blockText = ''; + + if (account.getIn(['relationship', 'blocking'])) { + buttonText = 'Blocked'; + disabled = true; + blockText = 'Unblock'; } else { - buttonText = 'Follow'; - } + if (account.getIn(['relationship', 'following'])) { + buttonText = 'Unfollow'; + } else { + buttonText = 'Follow'; + } + + if (account.getIn(['relationship', 'followed_by'])) { + infoText = 'Follows you!'; + } - if (account.getIn(['relationship', 'followed_by'])) { - infoText = 'Follows you!'; + blockText = 'Block'; } + + block =