diff options
author | enahum <nahumhbl@gmail.com> | 2016-05-10 09:24:52 -0300 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-05-10 08:24:52 -0400 |
commit | 45b22f312d3f57c63f86ffdbbb50c29108099993 (patch) | |
tree | 0921119d05ff8ae01a660269d3d1da639062c074 /webapp | |
parent | 4f39b8b2e4e919c036d37718346a420f5a36f885 (diff) | |
download | chat-45b22f312d3f57c63f86ffdbbb50c29108099993.tar.gz chat-45b22f312d3f57c63f86ffdbbb50c29108099993.tar.bz2 chat-45b22f312d3f57c63f86ffdbbb50c29108099993.zip |
PLT-2674 Private Group should not have Leave option when only one member remains (#2888)
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/components/channel_header.jsx | 3 | ||||
-rw-r--r-- | webapp/components/navbar.jsx | 31 |
2 files changed, 19 insertions, 15 deletions
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx index 992244915..ca3878d68 100644 --- a/webapp/components/channel_header.jsx +++ b/webapp/components/channel_header.jsx @@ -409,7 +409,8 @@ export default class ChannelHeader extends React.Component { } } - if (!ChannelStore.isDefault(channel)) { + const canLeave = channel.type === Constants.PRIVATE_CHANNEL ? this.state.userCount > 1 : true; + if (!ChannelStore.isDefault(channel) && canLeave) { dropdownContents.push( <li key='leave_channel' diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx index 21ca53649..ee199fc03 100644 --- a/webapp/components/navbar.jsx +++ b/webapp/components/navbar.jsx @@ -218,20 +218,23 @@ export default class Navbar extends React.Component { </li> ); - leaveChannelOption = ( - <li role='presentation'> - <a - role='menuitem' - href='#' - onClick={this.handleLeave} - > - <FormattedMessage - id='navbar.leave' - defaultMessage='Leave Channel' - /> - </a> - </li> - ); + const canLeave = channel.type === Constants.PRIVATE_CHANNEL ? this.state.userCount > 1 : true; + if (canLeave) { + leaveChannelOption = ( + <li role='presentation'> + <a + role='menuitem' + href='#' + onClick={this.handleLeave} + > + <FormattedMessage + id='navbar.leave' + defaultMessage='Leave Channel' + /> + </a> + </li> + ); + } } var manageMembersOption; |