From 870f78e413272a227e33aa30079e69ff360f3b92 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 3 May 2022 08:24:34 -0400 Subject: [PATCH 1/3] Add unmute action to ActionButton --- .../features/ui/components/action_button.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 + ); + } else if (account.getIn(['relationship', 'blocking'])) { + // Unblock + return ( + ); - } - - return (
- - -
); - } else if (account.getIn(['relationship', 'blocking'])) { - // Unblock - return