diff --git a/js/src/common/components/GroupBadge.ts b/js/src/common/components/GroupBadge.ts index 06a955276..0c0ae4d22 100644 --- a/js/src/common/components/GroupBadge.ts +++ b/js/src/common/components/GroupBadge.ts @@ -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()}`; } } } diff --git a/js/src/forum/components/PostUser.tsx b/js/src/forum/components/PostUser.tsx index 5c587353b..8edd4a6b8 100644 --- a/js/src/forum/components/PostUser.tsx +++ b/js/src/forum/components/PostUser.tsx @@ -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 { +export default class PostUser extends Component { /** * Whether or not the user hover card is visible. */