From 24b06e3a34006b6e440c96150fe30df600549160 Mon Sep 17 00:00:00 2001 From: Chris Raible Date: Wed, 19 Apr 2023 14:20:52 +0100 Subject: [PATCH] Wired up the author details to the post history modal no issue - added post-revision serializer to allow for embedded records in the post-revision ember model --- ghost/admin/app/serializers/post-revision.js | 14 ++++++++++++++ ghost/admin/app/serializers/post.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 ghost/admin/app/serializers/post-revision.js diff --git a/ghost/admin/app/serializers/post-revision.js b/ghost/admin/app/serializers/post-revision.js new file mode 100644 index 0000000000..593e6f4e4c --- /dev/null +++ b/ghost/admin/app/serializers/post-revision.js @@ -0,0 +1,14 @@ +/* eslint-disable camelcase */ +import ApplicationSerializer from 'ghost-admin/serializers/application'; +import {EmbeddedRecordsMixin} from '@ember-data/serializer/rest'; + +export default class PostRevisionSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) { + // settings for the EmbeddedRecordsMixin. + attrs = { + author: {embedded: 'always'}, + lexical: {key: 'lexical'}, + title: {key: 'title'}, + createdAt: {key: 'created_at'}, + postIdLocal: {key: 'post_id'} + }; +} diff --git a/ghost/admin/app/serializers/post.js b/ghost/admin/app/serializers/post.js index 83d1c585e1..78775c3536 100644 --- a/ghost/admin/app/serializers/post.js +++ b/ghost/admin/app/serializers/post.js @@ -12,7 +12,7 @@ export default class PostSerializer extends ApplicationSerializer.extend(Embedde updatedAtUTC: {key: 'updated_at'}, email: {embedded: 'always'}, newsletter: {embedded: 'always'}, - postRevisions: {embedded: 'always', key: 'postRevisions'} + postRevisions: {embedded: 'always'} }; serialize(/*snapshot, options*/) {