Merge pull request #393 from matrix-org/dbkr/enable_labs

Add config to hide the labs section
This commit is contained in:
David Baker 2016-08-05 17:25:25 +01:00 committed by GitHub
commit 4b8ad3c102
2 changed files with 14 additions and 2 deletions

View file

@ -1062,7 +1062,12 @@ module.exports = React.createClass({
right_panel = <RightPanel roomId={this.state.currentRoomId} collapsed={this.state.collapse_rhs} opacity={this.state.sideOpacity} /> right_panel = <RightPanel roomId={this.state.currentRoomId} collapsed={this.state.collapse_rhs} opacity={this.state.sideOpacity} />
break; break;
case this.PageTypes.UserSettings: 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.props.config.enableLabs}
/>
right_panel = <RightPanel collapsed={this.state.collapse_rhs} opacity={this.state.sideOpacity}/> right_panel = <RightPanel collapsed={this.state.collapse_rhs} opacity={this.state.sideOpacity}/>
break; break;
case this.PageTypes.CreateRoom: case this.PageTypes.CreateRoom:

View file

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