Support default values for boolean user opt-in settings during patron
registration. A default value of True, true, T, or t (or really
anything starting with a 't') is treated as true. Any other value
(including null) means false.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Josh Stompro <stomproj@larl.org>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
// apply default user setting values
angular.forEach(setting_types, function(stype, index) {
if (stype.reg_default() != undefined) {
- service.user_settings[stype.name()] =
- Boolean(stype.reg_default());
+ var val = stype.reg_default();
+ if (stype.datatype() == 'bool') {
+ // A boolean user setting type whose default
+ // value starts with t/T is considered 'true',
+ // false otherwise.
+ val = Boolean((val+'').match(/^t/i));
+ }
+ service.user_settings[stype.name()] = val;
}
});
}