From f94873bd5dad0eed04f7d70786b7bf265a9f57d2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Oct 2017 13:58:24 +0100 Subject: [PATCH 1/2] Honour the (now legacy) enableLabs flag --- src/UserSettingsStore.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 1071448b5b..7bcef8b7be 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -36,9 +36,16 @@ export default { getLabsFeatures() { const featuresConfig = SdkConfig.get()['features'] || {}; + // The old flag: honourned for backwards compat + const enableLabs = SdkConfig.get()['enableLabs']; + return FEATURES.filter((f) => { + if (enableLabs) { + return true; + } + const sdkConfigValue = featuresConfig[f.id]; - if (!['enable', 'disable'].includes(sdkConfigValue)) { + if (sdkConfigValue === 'labs') { return true; } }).map((f) => { From 4e793d4f68ad5c02af02330cef16cedb210b82de Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Oct 2017 14:11:21 +0100 Subject: [PATCH 2/2] skip unnecessary filter --- src/UserSettingsStore.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 7bcef8b7be..0a992dfbad 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -39,16 +39,18 @@ export default { // The old flag: honourned for backwards compat const enableLabs = SdkConfig.get()['enableLabs']; - return FEATURES.filter((f) => { - if (enableLabs) { - return true; - } - - const sdkConfigValue = featuresConfig[f.id]; - if (sdkConfigValue === 'labs') { - return true; - } - }).map((f) => { + let labsFeatures; + if (enableLabs) { + labsFeatures = FEATURES; + } else { + labsFeatures.filter((f) => { + const sdkConfigValue = featuresConfig[f.id]; + if (sdkConfigValue === 'labs') { + return true; + } + }); + } + return labsFeatures.map((f) => { return f.id; }); },