Updated group admin functionality
• Updated: - group admin functionality
This commit is contained in:
@@ -70,7 +70,7 @@ class GroupHeader extends ImmutablePureComponent {
|
||||
|
||||
handleOnOpenGroupOptions = () => {
|
||||
const { relationships } = this.props
|
||||
const isAdmin = relationships ? relationships.get('admin') : false
|
||||
const isAdmin = !!relationships ? relationships.get('admin') : false
|
||||
this.props.onOpenGroupOptions(this.infoBtn, this.props.group, isAdmin)
|
||||
}
|
||||
|
||||
|
||||
@@ -78,38 +78,40 @@ class GroupOptionsPopover extends ImmutablePureComponent {
|
||||
|
||||
const groupId = group.get('id')
|
||||
|
||||
const listItems = [
|
||||
{
|
||||
const listItems = []
|
||||
if (isAdmin) {
|
||||
listItems.push({
|
||||
hideArrow: true,
|
||||
icon: 'group',
|
||||
title: intl.formatMessage(messages.groupMembers),
|
||||
onClick: this.handleOnClosePopover,
|
||||
to: `/groups/${groupId}/members`,
|
||||
isHidden: !isAdmin,
|
||||
},
|
||||
{
|
||||
})
|
||||
listItems.push({
|
||||
hideArrow: true,
|
||||
icon: 'block',
|
||||
title: intl.formatMessage(messages.removedMembers),
|
||||
onClick: this.handleOnClosePopover,
|
||||
to: `/groups/${groupId}/removed-accounts`,
|
||||
isHidden: !isAdmin,
|
||||
},
|
||||
{
|
||||
})
|
||||
listItems.push({
|
||||
hideArrow: true,
|
||||
icon: 'pencil',
|
||||
title: intl.formatMessage(messages.editGroup),
|
||||
onClick: this.handleOnClosePopover,
|
||||
to: `/groups/${groupId}/edit`,
|
||||
isHidden: !isAdmin,
|
||||
},
|
||||
{
|
||||
hideArrow: true,
|
||||
icon: 'star',
|
||||
title: intl.formatMessage(isShortcut ? messages.remove_from_shortcuts : messages.add_to_shortcuts),
|
||||
onClick: this.handleOnToggleShortcut,
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
listItems.push({
|
||||
hideArrow: true,
|
||||
icon: 'star',
|
||||
title: intl.formatMessage(isShortcut ? messages.remove_from_shortcuts : messages.add_to_shortcuts),
|
||||
onClick: this.handleOnToggleShortcut,
|
||||
})
|
||||
|
||||
return (
|
||||
<PopoverLayout
|
||||
|
||||
Reference in New Issue
Block a user