mirror of https://github.com/vector-im/riot-web
default labs correctly :/
parent
96fd460cc8
commit
736b6dac7a
|
@ -24,6 +24,23 @@ var Notifier = require("./Notifier");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
LABS_FEATURES: [
|
||||||
|
{
|
||||||
|
name: 'Rich Text Editor',
|
||||||
|
id: 'rich_text_editor',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'End-to-End Encryption',
|
||||||
|
id: 'e2e_encryption',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Integration Management',
|
||||||
|
id: 'integration_management',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
loadProfileInfo: function() {
|
loadProfileInfo: function() {
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
|
@ -142,9 +159,14 @@ module.exports = {
|
||||||
return MatrixClientPeg.get().setAccountData("im.vector.web.settings", settings);
|
return MatrixClientPeg.get().setAccountData("im.vector.web.settings", settings);
|
||||||
},
|
},
|
||||||
|
|
||||||
isFeatureEnabled: function(feature: string): ?boolean {
|
isFeatureEnabled: function(feature: string): boolean {
|
||||||
if (localStorage.getItem(`mx_labs_feature_${feature}`) === null) {
|
if (localStorage.getItem(`mx_labs_feature_${feature}`) === null) {
|
||||||
return null;
|
for (var i = 0; i < this.LABS_FEATURES.length; i++) {
|
||||||
|
var f = this.LABS_FEATURES[i];
|
||||||
|
if (f.id === feature) {
|
||||||
|
return f.default;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return localStorage.getItem(`mx_labs_feature_${feature}`) === 'true';
|
return localStorage.getItem(`mx_labs_feature_${feature}`) === 'true';
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,24 +26,6 @@ var GeminiScrollbar = require('react-gemini-scrollbar');
|
||||||
var Email = require('../../email');
|
var Email = require('../../email');
|
||||||
var AddThreepid = require('../../AddThreepid');
|
var AddThreepid = require('../../AddThreepid');
|
||||||
|
|
||||||
const LABS_FEATURES = [
|
|
||||||
{
|
|
||||||
name: 'Rich Text Editor',
|
|
||||||
id: 'rich_text_editor',
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'End-to-End Encryption',
|
|
||||||
id: 'e2e_encryption',
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Integration Management',
|
|
||||||
id: 'integration_management',
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// if this looks like a release, use the 'version' from package.json; else use
|
// if this looks like a release, use the 'version' from package.json; else use
|
||||||
// the git sha.
|
// the git sha.
|
||||||
const REACT_SDK_VERSION =
|
const REACT_SDK_VERSION =
|
||||||
|
@ -379,13 +361,13 @@ module.exports = React.createClass({
|
||||||
// default to enabled if undefined
|
// default to enabled if undefined
|
||||||
if (this.props.enableLabs === false) return null;
|
if (this.props.enableLabs === false) return null;
|
||||||
|
|
||||||
let features = LABS_FEATURES.map(feature => (
|
let features = UserSettingsStore.LABS_FEATURES.map(feature => (
|
||||||
<div key={feature.id} className="mx_UserSettings_toggle">
|
<div key={feature.id} className="mx_UserSettings_toggle">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id={feature.id}
|
id={feature.id}
|
||||||
name={feature.id}
|
name={feature.id}
|
||||||
defaultChecked={UserSettingsStore.isFeatureEnabled(feature.id) === null ? feature.default : UserSettingsStore.isFeatureEnabled(feature.id)}
|
defaultChecked={ UserSettingsStore.isFeatureEnabled(feature.id) }
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
UserSettingsStore.setFeatureEnabled(feature.id, e.target.checked);
|
UserSettingsStore.setFeatureEnabled(feature.id, e.target.checked);
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
|
|
Loading…
Reference in New Issue