0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Removed 'null' parsing in settings model

refs #10582

- I don't think this is a good idea
- If a user passses "null", we should treat it as a string
- I am not aware of a use case why people have "null" in their database
- If people send "null" via the API, we should respect this and accept a string
This commit is contained in:
kirrg001 2019-03-11 17:25:45 +01:00 committed by Katharina Irrgang
parent 0c583135ba
commit 0c8373afb7
2 changed files with 1 additions and 6 deletions

View file

@ -116,7 +116,6 @@ Settings = ghostBookshelf.Model.extend({
// transform "0" to false
// transform "false" to false
// transform "null" to null
if (attrs.value === '0' || attrs.value === '1') {
attrs.value = !!+attrs.value;
}
@ -125,10 +124,6 @@ Settings = ghostBookshelf.Model.extend({
attrs.value = JSON.parse(attrs.value);
}
if (attrs.value === 'null') {
attrs.value = null;
}
return attrs;
}
}, {

View file

@ -29,7 +29,7 @@ describe('Unit: models/settings', function () {
should.equal(returns.value, true);
returns = setting.parse({key: 'something', value: 'null'});
should.equal(returns.value, null);
should.equal(returns.value, 'null');
});
});
});