RN-240 Fix create public channel policy (#690)

This commit is contained in:
enahum 2017-06-28 14:29:18 -04:00 committed by Harrison Healey
parent 5e979e53ab
commit 88940d576a
2 changed files with 8 additions and 2 deletions

View file

@ -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,

View file

@ -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}];
}