Added new role for moderator to Groups

• Added:
- new role for moderator to Groups
This commit is contained in:
mgabdev
2020-09-02 18:06:38 -05:00
parent cc224d7659
commit ac9b9e8448
8 changed files with 61 additions and 19 deletions

View File

@@ -15,8 +15,8 @@ class GroupMemberOptionsPopover extends React.PureComponent {
this.props.onCreateRemovedAccount(this.props.groupId, this.props.accountId)
}
handleOnMakeAdmin = () => {
this.props.onUpdateRole(this.props.groupId, this.props.accountId, 'admin')
handleOnUpdateRole = (role) => {
this.props.onUpdateRole(this.props.groupId, this.props.accountId, role)
}
handleOnClosePopover = () => {
@@ -24,7 +24,7 @@ class GroupMemberOptionsPopover extends React.PureComponent {
}
render() {
const { isXS } = this.props
const { isModerator, isXS } = this.props
const listItems = [
{
@@ -33,13 +33,23 @@ class GroupMemberOptionsPopover extends React.PureComponent {
title: 'Remove from group',
onClick: this.handleOnRemoveFromGroup,
},
{
]
if (!isModerator) {
listItems.push({
hideArrow: true,
icon: 'group',
title: 'Make group moderator',
onClick: () => this.handleOnUpdateRole('moderator'),
})
listItems.push({
hideArrow: true,
icon: 'group',
title: 'Make group admin',
onClick: this.handleOnMakeAdmin,
},
]
onClick: () => this.handleOnUpdateRole('admin'),
})
}
return (
<PopoverLayout
@@ -77,6 +87,7 @@ GroupMemberOptionsPopover.defaultProps = {
onClosePopover: PropTypes.func.isRequired,
onCreateRemovedAccount: PropTypes.func.isRequired,
onUpdateRole: PropTypes.func.isRequired,
isModerator: PropTypes.bool,
}
export default connect(null, mapDispatchToProps)(GroupMemberOptionsPopover)

View File

@@ -149,7 +149,7 @@ class StatusOptionsPopover extends ImmutablePureComponent {
const mutingConversation = status.get('muted')
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'))
const isReply = !!status.get('in_reply_to_id')
const withGroupAdmin = !!groupRelationships ? groupRelationships.get('admin') : false
const withGroupAdmin = !!groupRelationships ? (groupRelationships.get('admin') || groupRelationships.get('moderator')) : false
const mailToHref = !status ? undefined : `mailto:?subject=Gab&body=${status.get('url')}`
let menu = []