diff --git a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js index 2666671a30..6559448dfe 100644 --- a/src/components/views/settings/tabs/user/LabsUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/LabsUserSettingsTab.js @@ -28,7 +28,7 @@ export class LabsSettingToggle extends React.Component { }; _onChange = async (checked) => { - await SettingsStore.setFeatureEnabled(this.props.featureId, checked); + await SettingsStore.setValue(this.props.featureId, null, SettingLevel.DEVICE, checked); this.forceUpdate(); }; @@ -46,7 +46,7 @@ export default class LabsUserSettingsTab extends React.Component { render() { const SettingsFlag = sdk.getComponent("views.elements.SettingsFlag"); - const flags = SettingsStore.getLabsFeatures().map(f => ); + const flags = SettingsStore.getFeatureSettingNames().map(f => ); return (
{_t("Labs")}
diff --git a/src/settings/SettingsStore.ts b/src/settings/SettingsStore.ts index 6c1f9b8411..ea7d965720 100644 --- a/src/settings/SettingsStore.ts +++ b/src/settings/SettingsStore.ts @@ -124,6 +124,14 @@ export default class SettingsStore { // Counter used for generation of watcher IDs private static watcherCount = 1; + /** + * Gets all the feature-style setting names. + * @returns {string[]} The names of the feature settings. + */ + public static getFeatureSettingNames(): string[] { + return Object.keys(SETTINGS).filter(n => SettingsStore.isFeature(n)); + } + /** * Watches for changes in a particular setting. This is done without any local echo * wrapping and fires whenever a change is detected in a setting's value, at any level.