mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-26 23:41:52 +00:00
Add the role ID to the badge component (#29707)
This commit is contained in:
parent
05eda8d193
commit
ec1e770fea
|
@ -7,8 +7,8 @@ import PersonIcon from '@/material-icons/400-24px/person.svg?react';
|
|||
import SmartToyIcon from '@/material-icons/400-24px/smart_toy.svg?react';
|
||||
|
||||
|
||||
export const Badge = ({ icon, label, domain }) => (
|
||||
<div className='account-role'>
|
||||
export const Badge = ({ icon, label, domain, roleId }) => (
|
||||
<div className='account-role' data-account-role-id={roleId}>
|
||||
{icon}
|
||||
{label}
|
||||
{domain && <span className='account-role__domain'>{domain}</span>}
|
||||
|
@ -19,6 +19,7 @@ Badge.propTypes = {
|
|||
icon: PropTypes.node,
|
||||
label: PropTypes.node,
|
||||
domain: PropTypes.node,
|
||||
roleId: PropTypes.string
|
||||
};
|
||||
|
||||
Badge.defaultProps = {
|
||||
|
|
|
@ -408,7 +408,7 @@ class Header extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
account.get('roles', []).forEach((role) => {
|
||||
badges.push(<Badge key={`role-badge-${role.get('id')}`} label={<span>{role.get('name')}</span>} domain={domain} />);
|
||||
badges.push(<Badge key={`role-badge-${role.get('id')}`} label={<span>{role.get('name')}</span>} domain={domain} roleId={role.get('id')} />);
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue
Block a user