ProfileInfoPanel: avoid redundant staff badge

If the user is an admin, don't display the moderator badge
nank-fix
Alex Gleason 2021-07-13 11:21:37 -05:00
rodzic 955a4863f0
commit 4c82b4703b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -46,6 +46,18 @@ class ProfileInfoPanel extends ImmutablePureComponent {
displayFqn: PropTypes.bool,
};
getStaffBadge = () => {
const { account } = this.props;
if (isAdmin(account)) {
return <Badge slug='admin' title='Admin' />;
} else if (isModerator(account)) {
return <Badge slug='moderator' title='Moderator' />;
} else {
return null;
}
}
render() {
const { account, displayFqn, intl, identity_proofs, username } = this.props;
@ -86,8 +98,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
</div>
<div className='profile-info-panel-content__badges'>
{isAdmin(account) && <Badge slug='admin' title='Admin' />}
{isModerator(account) && <Badge slug='moderator' title='Moderator' />}
{this.getStaffBadge()}
{account.getIn(['patron', 'is_patron']) && <Badge slug='patron' title='Patron' />}
{account.get('acct').includes('@') || <div className='profile-info-panel-content__badges__join-date'>
<Icon id='calendar' />