mirror of https://github.com/vector-im/riot-web
Update LabsUserSettings for new feature behaviour
parent
96087d61f6
commit
eda4e24926
|
@ -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 => <LabsSettingToggle featureId={f} key={f} />);
|
||||
const flags = SettingsStore.getFeatureSettingNames().map(f => <LabsSettingToggle featureId={f} key={f} />);
|
||||
return (
|
||||
<div className="mx_SettingsTab">
|
||||
<div className="mx_SettingsTab_heading">{_t("Labs")}</div>
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue