Add config to hide the labs section

This commit is contained in:
David Baker 2016-08-05 16:13:06 +01:00
parent ff02c21252
commit e8ee5c2f96
2 changed files with 17 additions and 2 deletions

View file

@ -139,6 +139,10 @@ module.exports = React.createClass({
return this.props.config.default_is_url || "https://vector.im";
},
getEnableLabs() {
return this.props.config.enableLabs === undefined ? true : this.props.config.enableLabs;
},
componentWillMount: function() {
this.favicon = new Favico({animation: 'none'});
@ -1060,7 +1064,12 @@ module.exports = React.createClass({
right_panel = <RightPanel roomId={this.state.currentRoomId} collapsed={this.state.collapse_rhs} opacity={this.state.sideOpacity} />
break;
case this.PageTypes.UserSettings:
page_element = <UserSettings onClose={this.onUserSettingsClose} version={this.state.version} brand={this.props.config.brand} />
page_element = <UserSettings
onClose={this.onUserSettingsClose}
version={this.state.version}
brand={this.props.config.brand}
enableLabs={this.getEnableLabs()}
/>
right_panel = <RightPanel collapsed={this.state.collapse_rhs} opacity={this.state.sideOpacity}/>
break;
case this.PageTypes.CreateRoom:

View file

@ -50,11 +50,15 @@ module.exports = React.createClass({
onClose: React.PropTypes.func,
// The brand string given when creating email pushers
brand: React.PropTypes.string,
// True to show the 'labs' section of experimental features
enableLabs: React.PropTypes.boolean,
},
getDefaultProps: function() {
return {
onClose: function() {}
onClose: function() {},
enableLabs: true,
};
},
@ -359,6 +363,8 @@ module.exports = React.createClass({
},
_renderLabs: function () {
if (!this.props.enableLabs) return false;
let features = LABS_FEATURES.map(feature => (
<div key={feature.id} className="mx_UserSettings_toggle">
<input