diff --git a/core/server/api/v2/utils/serializers/input/pages.js b/core/server/api/v2/utils/serializers/input/pages.js index 65bc610308..02f2e475a2 100644 --- a/core/server/api/v2/utils/serializers/input/pages.js +++ b/core/server/api/v2/utils/serializers/input/pages.js @@ -25,6 +25,14 @@ function setDefaultOrder(frame) { } } +function defaultFormat(frame) { + if (frame.options.formats) { + return; + } + + frame.options.formats = 'mobiledoc'; +} + /** * CASE: * @@ -62,6 +70,7 @@ module.exports = { if (!localUtils.isContentAPI(frame)) { forceStatusFilter(frame); + defaultFormat(frame); } debug(frame.options); @@ -79,6 +88,7 @@ module.exports = { if (!localUtils.isContentAPI(frame)) { forceStatusFilter(frame); + defaultFormat(frame); } debug(frame.options); @@ -122,6 +132,8 @@ module.exports = { } }); } + + defaultFormat(frame); }, edit(apiConfig, frame) { @@ -138,5 +150,7 @@ module.exports = { id: frame.options.id, page: true }; + + defaultFormat(frame); } }; diff --git a/core/server/api/v2/utils/serializers/input/posts.js b/core/server/api/v2/utils/serializers/input/posts.js index 9ded79f0f1..58de3fc7e5 100644 --- a/core/server/api/v2/utils/serializers/input/posts.js +++ b/core/server/api/v2/utils/serializers/input/posts.js @@ -34,6 +34,14 @@ function setDefaultOrder(frame) { } } +function defaultFormat(frame) { + if (frame.options.formats) { + return; + } + + frame.options.formats = 'mobiledoc'; +} + /** * CASE: * @@ -84,6 +92,7 @@ module.exports = { if (!localUtils.isContentAPI(frame)) { forceStatusFilter(frame); + defaultFormat(frame); } debug(frame.options); @@ -114,6 +123,7 @@ module.exports = { if (!localUtils.isContentAPI(frame)) { forceStatusFilter(frame); + defaultFormat(frame); } debug(frame.options); @@ -157,6 +167,8 @@ module.exports = { } }); } + + defaultFormat(frame); }, edit(apiConfig, frame) { @@ -171,5 +183,7 @@ module.exports = { id: frame.options.id, page: false }; + + defaultFormat(frame); } }; diff --git a/core/test/acceptance/old/admin/posts_spec.js b/core/test/acceptance/old/admin/posts_spec.js index 835407eae3..4ae9b6222c 100644 --- a/core/test/acceptance/old/admin/posts_spec.js +++ b/core/test/acceptance/old/admin/posts_spec.js @@ -77,7 +77,7 @@ describe('Posts API', function () { should.exist(jsonResponse.posts); localUtils.API.checkResponse(jsonResponse, 'posts'); jsonResponse.posts.should.have.length(3); - localUtils.API.checkResponse(jsonResponse.posts[0], 'post', ['mobiledoc', 'plaintext'], ['html', 'primary_tag', 'primary_author']); + localUtils.API.checkResponse(jsonResponse.posts[0], 'post', ['mobiledoc', 'plaintext'], ['primary_tag', 'primary_author']); localUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination'); _.isBoolean(jsonResponse.posts[0].featured).should.eql(true); diff --git a/core/test/acceptance/old/admin/utils.js b/core/test/acceptance/old/admin/utils.js index 2730de87a3..de6202ec98 100644 --- a/core/test/acceptance/old/admin/utils.js +++ b/core/test/acceptance/old/admin/utils.js @@ -24,8 +24,8 @@ const expectedProperties = { post: _(schema.posts) .keys() - // by default we only return html - .without('mobiledoc', 'plaintext') + // by default we only return mobildoc + .without('html', 'plaintext') .without('visibility') .without('locale') .without('page') @@ -35,8 +35,8 @@ const expectedProperties = { page: _(schema.posts) .keys() - // by default we only return html - .without('mobiledoc', 'plaintext') + // by default we only return mobildoc + .without('html', 'plaintext') .without('visibility') .without('locale') .without('page') diff --git a/core/test/regression/api/v2/admin/utils.js b/core/test/regression/api/v2/admin/utils.js index 8c8a0600db..302a4ed1ec 100644 --- a/core/test/regression/api/v2/admin/utils.js +++ b/core/test/regression/api/v2/admin/utils.js @@ -20,8 +20,8 @@ const expectedProperties = { post: _(schema.posts) .keys() - // by default we only return html - .without('mobiledoc', 'plaintext') + // by default we only return mobiledoc + .without('html', 'plaintext') .without('visibility') .without('locale') .without('page')