mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
forum: use 'extract' in GroupBadge instead of 'delete'
This commit is contained in:
parent
babbda044b
commit
3027916d97
|
@ -1,16 +1,17 @@
|
|||
import Badge from './Badge';
|
||||
import extract from '../utils/extract';
|
||||
|
||||
export default class GroupBadge extends Badge {
|
||||
static initProps(props) {
|
||||
super.initProps(props);
|
||||
|
||||
if (props.group) {
|
||||
props.icon = props.group.icon();
|
||||
props.style = { backgroundColor: props.group.color() };
|
||||
props.label = typeof props.label === 'undefined' ? props.group.nameSingular() : props.label;
|
||||
props.type = `group--${props.group.id()}`;
|
||||
const group = extract(props, 'group');
|
||||
|
||||
delete props.group;
|
||||
if (group) {
|
||||
props.icon = group.icon();
|
||||
props.style = { backgroundColor: group.color() };
|
||||
props.label = typeof props.label === 'undefined' ? group.nameSingular() : props.label;
|
||||
props.type = `group--${group.id()}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,12 @@ import avatar from '../../common/helpers/avatar';
|
|||
import username from '../../common/helpers/username';
|
||||
import userOnline from '../../common/helpers/userOnline';
|
||||
import listItems from '../../common/helpers/listItems';
|
||||
import { PostProps } from './Post';
|
||||
import LinkButton from '../../common/components/LinkButton';
|
||||
import { PostProp } from '../../common/concerns/ComponentProps';
|
||||
|
||||
/**
|
||||
* The `PostUser` component shows the avatar and username of a post's author.
|
||||
*/
|
||||
export default class PostUser extends Component<PostProps> {
|
||||
export default class PostUser extends Component<PostProp> {
|
||||
/**
|
||||
* Whether or not the user hover card is visible.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user