Skip to content

Commit 0f139ed

Browse files
shiv-tyagipeterbarker
authored andcommitted
scripts: add_build.js: treat all non zero default values to be true
This allows all non zero default values to be true to check the corresponding checkbox for the option in app
1 parent affec7f commit 0f139ed

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

static/js/add_build.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ const Features = (() => {
6565
return 'category_'+category_name.split(" ").join("_");
6666
}
6767

68+
function featureIsDisabledByDefault(feature_label) {
69+
return getOptionByLabel(feature_label).default == 0;
70+
}
71+
72+
function featureisEnabledByDefault(feature_label) {
73+
return !featureIsDisabledByDefault(feature_label);
74+
}
75+
6876
function updateDefaults(defines_array) {
6977
// updates default on the basis of define array passed
7078
// the define array consists define in format, EXAMPLE_DEFINE or !EXAMPLE_DEFINE
@@ -210,7 +218,7 @@ const Features = (() => {
210218
function applyDefaults() {
211219
features.forEach(category => {
212220
category['options'].forEach(option => {
213-
const check = option['default'] == 1;
221+
const check = featureisEnabledByDefault(option.label);
214222
checkUncheckOptionByLabel(option.label, check);
215223
});
216224
});

0 commit comments

Comments
 (0)