Hide negative follower counts from glitch flavour
This commit is contained in:
parent
20418dc7a7
commit
3ba1aa8d2b
2 changed files with 3 additions and 3 deletions
|
@ -164,7 +164,7 @@ export default class ActionBar extends React.PureComponent {
|
|||
|
||||
<NavLink exact activeClassName='active' className='account__action-bar__tab' to={`/accounts/${account.get('id')}/followers`}>
|
||||
<FormattedMessage id='account.followers' defaultMessage='Followers' />
|
||||
<strong><FormattedNumber value={account.get('followers_count')} /></strong>
|
||||
<strong>{ account.get('followers_count') < 0 ? '-' : <FormattedNumber value={account.get('followers_count')} /> }</strong>
|
||||
</NavLink>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -141,9 +141,9 @@ export default function accountsCounters(state = initialState, action) {
|
|||
if (action.alreadyFollowing) {
|
||||
return state;
|
||||
}
|
||||
return state.updateIn([action.relationship.id, 'followers_count'], num => num + 1);
|
||||
return state.updateIn([action.relationship.id, 'followers_count'], num => num < 0 ? num : num + 1);
|
||||
case ACCOUNT_UNFOLLOW_SUCCESS:
|
||||
return state.updateIn([action.relationship.id, 'followers_count'], num => Math.max(0, num - 1));
|
||||
return state.updateIn([action.relationship.id, 'followers_count'], num => num < 0 ? num : Math.max(0, num - 1));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue