diff --git a/app/soapbox/features/ui/components/action_button.js b/app/soapbox/features/ui/components/action_button.js index 926134c39..37562454c 100644 --- a/app/soapbox/features/ui/components/action_button.js +++ b/app/soapbox/features/ui/components/action_button.js @@ -10,6 +10,8 @@ import { unfollowAccount, blockAccount, unblockAccount, + muteAccount, + unmuteAccount, } from 'soapbox/actions/accounts'; import { openModal } from 'soapbox/actions/modals'; import Icon from 'soapbox/components/icon'; @@ -23,6 +25,7 @@ const messages = defineMessages({ requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, requested_small: { id: 'account.requested_small', defaultMessage: 'Awaiting approval' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, + unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' }, blocked: { id: 'account.blocked', defaultMessage: 'Blocked' }, }); @@ -54,6 +57,14 @@ const mapDispatchToProps = (dispatch) => ({ } }, + onMute(account) { + if (account.getIn(['relationship', 'muting'])) { + dispatch(unmuteAccount(account.get('id'))); + } else { + dispatch(muteAccount(account.get('id'))); + } + }, + onOpenUnauthorizedModal(account) { dispatch(openModal('UNAUTHORIZED', { action: 'FOLLOW', @@ -97,6 +108,10 @@ class ActionButton extends ImmutablePureComponent { this.props.onBlock(this.props.account); } + handleMute = () => { + this.props.onMute(this.props.account); + } + handleRemoteFollow = () => { this.props.onOpenUnauthorizedModal(this.props.account); } @@ -133,7 +148,7 @@ class ActionButton extends ImmutablePureComponent { } else if (account.getIn(['relationship', 'requested'])) { // Awaiting acceptance return