From f5f1221e1468aef72977ef1c88ff447de4317bd5 Mon Sep 17 00:00:00 2001 From: Naz Date: Mon, 16 May 2022 18:10:11 +0800 Subject: [PATCH] Removed output of "page" attributes from APIs refs https://github.com/TryGhost/Toolbox/issues/332 refs https://github.com/TryGhost/Ghost/issues/10922 - The "page" attirbute has been deprecated long time ago and was kept around in the output for back compatibility reasons. With Ghost 5.0 there's no longer need to return this field or keep around any of the code supporting "page" attribute processing --- .../canary/utils/serializers/output/mappers/posts.js | 4 ---- test/e2e-api/content/__snapshots__/pages.test.js.snap | 10 ++-------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/core/server/api/canary/utils/serializers/output/mappers/posts.js b/core/server/api/canary/utils/serializers/output/mappers/posts.js index a1dfe69e29..e6895c0cae 100644 --- a/core/server/api/canary/utils/serializers/output/mappers/posts.js +++ b/core/server/api/canary/utils/serializers/output/mappers/posts.js @@ -55,10 +55,6 @@ module.exports = async (model, frame, options = {}) => { } if (utils.isContentAPI(frame)) { - // Content api v2 still expects page prop - if (jsonModel.type === 'page') { - jsonModel.page = true; - } date.forPost(jsonModel); gating.forPost(jsonModel, frame); } diff --git a/test/e2e-api/content/__snapshots__/pages.test.js.snap b/test/e2e-api/content/__snapshots__/pages.test.js.snap index d746b0e834..36fe0cd62a 100644 --- a/test/e2e-api/content/__snapshots__/pages.test.js.snap +++ b/test/e2e-api/content/__snapshots__/pages.test.js.snap @@ -27,7 +27,6 @@ Hopefully you don't find it a bore.", "og_description": null, "og_image": null, "og_title": null, - "page": true, "published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000\\\\\\+\\\\d\\{2\\}:\\\\d\\{2\\}/, "reading_time": 0, "slug": "static-page-test", @@ -48,7 +47,7 @@ exports[`Pages Content API Can request page 2: [headers] 1`] = ` Object { "access-control-allow-origin": "*", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "1078", + "content-length": "1066", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Accept-Encoding", @@ -95,7 +94,6 @@ An about page is a great example of one you might want to set up early on so peo "og_description": null, "og_image": null, "og_title": null, - "page": true, "published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000\\\\\\+\\\\d\\{2\\}:\\\\d\\{2\\}/, "reading_time": 0, "slug": "about", @@ -139,7 +137,6 @@ If you prefer to use a contact form, almost all of the great embedded form servi "og_description": null, "og_image": null, "og_title": null, - "page": true, "published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000\\\\\\+\\\\d\\{2\\}:\\\\d\\{2\\}/, "reading_time": 1, "slug": "contact", @@ -179,7 +176,6 @@ Ghost is a non-profit organization, and we give away all our intellectual proper "og_description": null, "og_image": null, "og_title": null, - "page": true, "published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000\\\\\\+\\\\d\\{2\\}:\\\\d\\{2\\}/, "reading_time": 0, "slug": "contribute", @@ -216,7 +212,6 @@ You can integrate any products, services, ads or integrations with Ghost yoursel "og_description": null, "og_image": null, "og_title": null, - "page": true, "published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000\\\\\\+\\\\d\\{2\\}:\\\\d\\{2\\}/, "reading_time": 0, "slug": "privacy", @@ -253,7 +248,6 @@ Hopefully you don't find it a bore.", "og_description": null, "og_image": null, "og_title": null, - "page": true, "published_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000\\\\\\+\\\\d\\{2\\}:\\\\d\\{2\\}/, "reading_time": 0, "slug": "static-page-test", @@ -274,7 +268,7 @@ exports[`Pages Content API Can request pages 2: [headers] 1`] = ` Object { "access-control-allow-origin": "*", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "9124", + "content-length": "9064", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Accept-Encoding",