Added input serialization for settings API v2 to transform "0"/"1" booleans

refs #10582

- otherwise we will forward string booleans to model layer
- causes trouble if we trigger events
- causes trouble if we want to add conditions to the model e.g. setting.get('value') ?
This commit is contained in:
kirrg001 2019-03-07 12:16:12 +01:00 committed by Katharina Irrgang
parent f80a9429b9
commit 037ac4d748

View File

@ -26,10 +26,16 @@ module.exports = {
setting.value = JSON.stringify(setting.value);
}
// CASE: Ensure we won't forward strings, otherwise model events or model interactions can fail
if (setting.value === '0' || setting.value === '1') {
setting.value = !!+setting.value;
}
// CASE: Ensure we won't forward strings, otherwise model events or model interactions can fail
if (setting.value === 'false' || setting.value === 'true') {
setting.value = setting.value === 'true';
}
if (setting.key === 'codeinjection_head') {
setting.key = 'ghost_head';
}