Skip to content

Commit 72023d3

Browse files
kevinansfieldacburdine
authored andcommitted
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
1 parent b2cdfb8 commit 72023d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/client/app/serializers/post.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
99
tags: {embedded: 'always'}
1010
},
1111

12-
normalizeHash: {
12+
normalize(model, hash, prop) {
1313
// this is to enable us to still access the raw authorId
1414
// without requiring an extra get request (since it is an
1515
// async relationship).
16-
posts(hash) {
16+
if ((prop === 'post' || prop === 'posts') && hash.author !== undefined) {
1717
hash.author_id = hash.author;
18-
return hash;
1918
}
19+
20+
return this._super(...arguments);
2021
},
2122

2223
normalizeSingleResponse(store, primaryModelClass, payload) {

0 commit comments

Comments
 (0)