From 88940d576ae3595cb5e7b6ac7c3767cb9a9e7f0d Mon Sep 17 00:00:00 2001 From: enahum Date: Wed, 28 Jun 2017 14:29:18 -0400 Subject: [PATCH] RN-240 Fix create public channel policy (#690) --- app/screens/more_channels/index.js | 2 +- app/screens/more_channels/more_channels.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/screens/more_channels/index.js b/app/screens/more_channels/index.js index 8cd58fb7d..74bfc07f7 100644 --- a/app/screens/more_channels/index.js +++ b/app/screens/more_channels/index.js @@ -29,7 +29,7 @@ function mapStateToProps(state, ownProps) { return { ...ownProps, - canCreateChannels: showCreateOption(config, license, General.PRIVATE_CHANNEL, isAdmin(roles), isSystemAdmin(roles)), + canCreateChannels: showCreateOption(config, license, General.OPEN_CHANNEL, isAdmin(roles), isSystemAdmin(roles)), currentUserId, currentTeamId, channels, diff --git a/app/screens/more_channels/more_channels.js b/app/screens/more_channels/more_channels.js index 64f38c0a6..a504bbe8b 100644 --- a/app/screens/more_channels/more_channels.js +++ b/app/screens/more_channels/more_channels.js @@ -100,6 +100,8 @@ class MoreChannels extends PureComponent { const channels = nextProps.channels.splice(0, (page + 1) * General.CHANNELS_CHUNK_SIZE); this.setState({channels, showNoResults: true}); } + + this.headerButtons(nextProps.canCreateChannels, true); } close = () => { @@ -107,11 +109,15 @@ class MoreChannels extends PureComponent { }; emitCanCreateChannel = (enabled) => { + this.headerButtons(this.props.canCreateChannels, enabled); + }; + + headerButtons = (canCreateChannels, enabled) => { const buttons = { leftButtons: [this.leftButton] }; - if (this.props.canCreateChannels) { + if (canCreateChannels) { buttons.rightButtons = [{...this.rightButton, disabled: !enabled}]; }