mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 19:46:37 +03:00
fix underscore usage in post serializer
closes #6512 - because of the keyForAttribute method in the application serializer, the hash property must be snake_case - change the normalize method to the more concise normalizeHash method available on the rest serializer
This commit is contained in:
parent
39b326aa6d
commit
1ed2a8b6a7
@ -11,13 +11,14 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
|||||||
tags: {embedded: 'always'}
|
tags: {embedded: 'always'}
|
||||||
},
|
},
|
||||||
|
|
||||||
normalize(typeClass, hash, prop) {
|
normalizeHash: {
|
||||||
// this is to enable us to still access the raw authorId
|
// this is to enable us to still access the raw authorId
|
||||||
// without requiring an extra get request (since it is an
|
// without requiring an extra get request (since it is an
|
||||||
// async relationship).
|
// async relationship).
|
||||||
hash.authorId = hash.author;
|
posts(hash) {
|
||||||
|
hash.author_id = hash.author;
|
||||||
return this._super(typeClass, hash, prop);
|
return hash;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeSingleResponse(store, primaryModelClass, payload) {
|
normalizeSingleResponse(store, primaryModelClass, payload) {
|
||||||
@ -47,7 +48,7 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
|||||||
delete data.uuid;
|
delete data.uuid;
|
||||||
delete data.html;
|
delete data.html;
|
||||||
// Inserted locally as a convenience.
|
// Inserted locally as a convenience.
|
||||||
delete data.authorId;
|
delete data.author_id;
|
||||||
// Read-only virtual property.
|
// Read-only virtual property.
|
||||||
delete data.url;
|
delete data.url;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user