Skip to content

Commit

Permalink
Fix block/mute lists showing a follow button when unblocking a user (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored May 9, 2022
1 parent f714e24 commit 662ed53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion app/javascript/mastodon/components/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const messages = defineMessages({
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' },
unmute_notifications: { id: 'account.unmute_notifications', defaultMessage: 'Unmute notifications from @{name}' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
});

export default @injectIntl
Expand All @@ -33,6 +35,7 @@ class Account extends ImmutablePureComponent {
hidden: PropTypes.bool,
actionIcon: PropTypes.string,
actionTitle: PropTypes.string,
defaultAction: PropTypes.string,
onActionClick: PropTypes.func,
};

Expand Down Expand Up @@ -61,7 +64,7 @@ class Account extends ImmutablePureComponent {
}

render () {
const { account, intl, hidden, onActionClick, actionIcon, actionTitle } = this.props;
const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction } = this.props;

if (!account) {
return <div />;
Expand Down Expand Up @@ -105,6 +108,10 @@ class Account extends ImmutablePureComponent {
{hidingNotificationsButton}
</Fragment>
);
} else if (defaultAction === 'mute') {
buttons = <IconButton icon='volume-off' title={intl.formatMessage(messages.mute, { name: account.get('username') })} onClick={this.handleMute} />;
} else if (defaultAction === 'block') {
buttons = <IconButton icon='lock' title={intl.formatMessage(messages.block, { name: account.get('username') })} onClick={this.handleBlock} />;
} else if (!account.get('moved') || following) {
buttons = <IconButton icon={following ? 'user-times' : 'user-plus'} title={intl.formatMessage(following ? messages.unfollow : messages.follow)} onClick={this.handleFollow} active={following} />;
}
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Blocks extends ImmutablePureComponent {
bindToDocument={!multiColumn}
>
{accountIds.map(id =>
<AccountContainer key={id} id={id} />,
<AccountContainer key={id} id={id} defaultAction='block' />,
)}
</ScrollableList>
</Column>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/mutes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Mutes extends ImmutablePureComponent {
bindToDocument={!multiColumn}
>
{accountIds.map(id =>
<AccountContainer key={id} id={id} />,
<AccountContainer key={id} id={id} defaultAction='mute' />,
)}
</ScrollableList>
</Column>
Expand Down

0 comments on commit 662ed53

Please sign in to comment.