mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
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:
parent
f80a9429b9
commit
037ac4d748
@ -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';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user