mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
forum: use 'extract' in GroupBadge instead of 'delete'
This commit is contained in:
@@ -1,16 +1,17 @@
|
|||||||
import Badge from './Badge';
|
import Badge from './Badge';
|
||||||
|
import extract from '../utils/extract';
|
||||||
|
|
||||||
export default class GroupBadge extends Badge {
|
export default class GroupBadge extends Badge {
|
||||||
static initProps(props) {
|
static initProps(props) {
|
||||||
super.initProps(props);
|
super.initProps(props);
|
||||||
|
|
||||||
if (props.group) {
|
const group = extract(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()}`;
|
|
||||||
|
|
||||||
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 username from '../../common/helpers/username';
|
||||||
import userOnline from '../../common/helpers/userOnline';
|
import userOnline from '../../common/helpers/userOnline';
|
||||||
import listItems from '../../common/helpers/listItems';
|
import listItems from '../../common/helpers/listItems';
|
||||||
import { PostProps } from './Post';
|
import { PostProp } from '../../common/concerns/ComponentProps';
|
||||||
import LinkButton from '../../common/components/LinkButton';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `PostUser` component shows the avatar and username of a post's author.
|
* 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.
|
* Whether or not the user hover card is visible.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user