mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
18d7a7b55d
no issue We've seen an issue where after an import a user record had `tour: ""` which meant they were unable to log in due to JSON parsing of the empty string failing. - add a guard so that an empty string is transformed to `null` before parsing - changed `serialised` to `serialized` to match spelling in all other serializers
12 lines
330 B
JavaScript
12 lines
330 B
JavaScript
import Transform from 'ember-data/transform';
|
|
|
|
export default Transform.extend({
|
|
deserialize(serialized) {
|
|
let _serialized = serialized === '' ? null : serialized;
|
|
return JSON.parse(_serialized);
|
|
},
|
|
serialize(deserialized) {
|
|
return deserialized ? JSON.stringify(deserialized) : null;
|
|
}
|
|
});
|