mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Fix redirect to posts list when saving a new post as an author
no issue - replace deprecated `normalizeHash` with `normalize` in post serializer - ensure we check for both `post` and `posts` properties as it will vary depending on the expected response type
This commit is contained in:
parent
0f39b4c53c
commit
490f2bae16
@ -9,14 +9,15 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
||||
tags: {embedded: 'always'}
|
||||
},
|
||||
|
||||
normalizeHash: {
|
||||
normalize(model, hash, prop) {
|
||||
// this is to enable us to still access the raw authorId
|
||||
// without requiring an extra get request (since it is an
|
||||
// async relationship).
|
||||
posts(hash) {
|
||||
if ((prop === 'post' || prop === 'posts') && hash.author !== undefined) {
|
||||
hash.author_id = hash.author;
|
||||
return hash;
|
||||
}
|
||||
|
||||
return this._super(...arguments);
|
||||
},
|
||||
|
||||
normalizeSingleResponse(store, primaryModelClass, payload) {
|
||||
|
Loading…
Reference in New Issue
Block a user