diff options
author | George Goldberg <george@gberg.me> | 2017-04-04 19:43:22 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-04-04 14:43:22 -0400 |
commit | 6bb65ef420fba17ec02e9b8005ca58bb60321cdc (patch) | |
tree | a7f07fd4ae05c92ed0f0fa5496277514e5d1c59e /webapp/components/channel_members_modal.jsx | |
parent | 6bf080393d88534aa658ecaff32ae089bd304772 (diff) | |
download | chat-6bb65ef420fba17ec02e9b8005ca58bb60321cdc.tar.gz chat-6bb65ef420fba17ec02e9b8005ca58bb60321cdc.tar.bz2 chat-6bb65ef420fba17ec02e9b8005ca58bb60321cdc.zip |
PLT-6139 (WebApp): Manage Private Channel Members (#5947)
Honour the policy setting for add/remove members from private channels
in the WebApp UI.
Diffstat (limited to 'webapp/components/channel_members_modal.jsx')
-rw-r--r-- | webapp/components/channel_members_modal.jsx | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/webapp/components/channel_members_modal.jsx b/webapp/components/channel_members_modal.jsx index ec5423fe2..a82c620ca 100644 --- a/webapp/components/channel_members_modal.jsx +++ b/webapp/components/channel_members_modal.jsx @@ -3,6 +3,12 @@ import MemberListChannel from './member_list_channel.jsx'; +import TeamStore from 'stores/team_store.jsx'; +import UserStore from 'stores/user_store.jsx'; +import ChannelStore from 'stores/channel_store.jsx'; + +import {canManageMembers} from 'utils/channel_utils.jsx'; + import React from 'react'; import {Modal} from 'react-bootstrap'; import {FormattedMessage} from 'react-intl'; @@ -24,6 +30,30 @@ export default class ChannelMembersModal extends React.Component { } render() { + const isSystemAdmin = UserStore.isSystemAdminForCurrentUser(); + const isTeamAdmin = TeamStore.isTeamAdminForCurrentTeam(); + const isChannelAdmin = ChannelStore.isChannelAdminForCurrentChannel(); + + let addMembersButton = null; + if (canManageMembers(this.state.channel, isSystemAdmin, isTeamAdmin, isChannelAdmin)) { + addMembersButton = ( + <a + id='showInviteModal' + className='btn btn-md btn-primary' + href='#' + onClick={() => { + this.props.showInviteModal(); + this.onHide(); + }} + > + <FormattedMessage + id='channel_members_modal.addNew' + defaultMessage=' Add New Members' + /> + </a> + ); + } + return ( <div> <Modal @@ -40,20 +70,7 @@ export default class ChannelMembersModal extends React.Component { defaultMessage=' Members' /> </Modal.Title> - <a - id='showInviteModal' - className='btn btn-md btn-primary' - href='#' - onClick={() => { - this.props.showInviteModal(); - this.onHide(); - }} - > - <FormattedMessage - id='channel_members_modal.addNew' - defaultMessage=' Add New Members' - /> - </a> + {addMembersButton} </Modal.Header> <Modal.Body ref='modalBody' |