From 7ad1be2555feb11ade20fc4a1856eab206b2b30c Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 13 Sep 2022 13:28:02 +0100 Subject: [PATCH] Fixed Content API returning lexical format when requested no issue - similar to the `mobiledoc` field, the Content API should not return the source `lexical` field if requested via `?formats=` - renamed `removeMobiledocFormat()` to `removeSourceFormats()` to better match it's behaviour --- .../utils/serializers/input/pages.js | 10 +- .../utils/serializers/input/posts.js | 14 +- .../content/__snapshots__/pages.test.js.snap | 337 +++++++++++ .../content/__snapshots__/posts.test.js.snap | 550 ++++++++++++++++++ ghost/core/test/e2e-api/content/pages.test.js | 7 + ghost/core/test/e2e-api/content/posts.test.js | 7 + 6 files changed, 913 insertions(+), 12 deletions(-) diff --git a/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js b/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js index 6e25284f2f..9dacaf2c39 100644 --- a/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js +++ b/ghost/core/core/server/api/endpoints/utils/serializers/input/pages.js @@ -7,10 +7,10 @@ const localUtils = require('../../index'); const postsMetaSchema = require('../../../../../data/schema').tables.posts_meta; const clean = require('./utils/clean'); -function removeMobiledocFormat(frame) { - if (frame.options.formats && frame.options.formats.includes('mobiledoc')) { +function removeSourceFormats(frame) { + if (frame.options.formats?.includes('mobiledoc') || frame.options.formats?.includes('lexical')) { frame.options.formats = frame.options.formats.filter((format) => { - return (format !== 'mobiledoc'); + return !['mobiledoc', 'lexical'].includes(format); }); } } @@ -95,7 +95,7 @@ module.exports = { forcePageFilter(frame); if (localUtils.isContentAPI(frame)) { - removeMobiledocFormat(frame); + removeSourceFormats(frame); setDefaultOrder(frame); forceVisibilityColumn(frame); } @@ -113,7 +113,7 @@ module.exports = { forcePageFilter(frame); if (localUtils.isContentAPI(frame)) { - removeMobiledocFormat(frame); + removeSourceFormats(frame); setDefaultOrder(frame); forceVisibilityColumn(frame); } diff --git a/ghost/core/core/server/api/endpoints/utils/serializers/input/posts.js b/ghost/core/core/server/api/endpoints/utils/serializers/input/posts.js index 0fae8f7f32..af2f5a2374 100644 --- a/ghost/core/core/server/api/endpoints/utils/serializers/input/posts.js +++ b/ghost/core/core/server/api/endpoints/utils/serializers/input/posts.js @@ -7,10 +7,10 @@ const mobiledoc = require('../../../../../lib/mobiledoc'); const postsMetaSchema = require('../../../../../data/schema').tables.posts_meta; const clean = require('./utils/clean'); -function removeMobiledocFormat(frame) { - if (frame.options.formats && frame.options.formats.includes('mobiledoc')) { +function removeSourceFormats(frame) { + if (frame.options.formats?.includes('mobiledoc') || frame.options.formats?.includes('lexical')) { frame.options.formats = frame.options.formats.filter((format) => { - return (format !== 'mobiledoc'); + return !['mobiledoc', 'lexical'].includes(format); }); } } @@ -101,8 +101,8 @@ module.exports = { * - user exists? admin api access */ if (localUtils.isContentAPI(frame)) { - // CASE: the content api endpoint for posts should not return mobiledoc - removeMobiledocFormat(frame); + // CASE: the content api endpoint for posts should not return mobiledoc or lexical + removeSourceFormats(frame); setDefaultOrder(frame); forceVisibilityColumn(frame); @@ -127,8 +127,8 @@ module.exports = { * - user exists? admin api access */ if (localUtils.isContentAPI(frame)) { - // CASE: the content api endpoint for posts should not return mobiledoc - removeMobiledocFormat(frame); + // CASE: the content api endpoint for posts should not return mobiledoc or lexical + removeSourceFormats(frame); setDefaultOrder(frame); forceVisibilityColumn(frame); diff --git a/ghost/core/test/e2e-api/content/__snapshots__/pages.test.js.snap b/ghost/core/test/e2e-api/content/__snapshots__/pages.test.js.snap index 3b7d1c21cf..25fbebff52 100644 --- a/ghost/core/test/e2e-api/content/__snapshots__/pages.test.js.snap +++ b/ghost/core/test/e2e-api/content/__snapshots__/pages.test.js.snap @@ -281,3 +281,340 @@ Object { "x-powered-by": "Express", } `; + +exports[`Pages Content API Cannot request mobiledoc or lexical formats 1: [body] 1`] = ` +Object { + "meta": Object { + "pagination": Object { + "limit": 15, + "next": null, + "page": 1, + "pages": 1, + "prev": null, + "total": 9, + }, + }, + "pages": Array [ + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a78", + "comments": false, + "created_at": "2022-09-13T11:26:48.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "Unlike posts, pages in Ghost don't appear in the main feed. They're separate, individual pages which only show up when you link to them. Great for content which is important, but separate from your usual posts. + +An about page is a great example of one you might want to set up early on so people can find out more about you, and what you do. Why should people subscribe to your site and become a member? Details help! + +Tip: If you're reading any post or page on your site and you notice something you", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a78", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:26:55.000+00:00", + "slug": "about", + "title": "About this site", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:48.000+00:00", + "url": "http://127.0.0.1:2369/about/", + "uuid": "1b074948-5f10-480d-b5f2-862178143619", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a79", + "comments": false, + "created_at": "2022-09-13T11:26:48.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "If you want to set up a contact page for people to be able to reach out to you, the simplest way is to set up a simple page like this and list the different ways people can reach out to you. + + +For example, here's how to reach us! + + * @Ghost on Twitter + * @Ghost on Facebook + * @Ghost on Instagram + +If you prefer to use a contact form, almost all of the great embedded form services work great with Ghost and are easy to set up:", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a79", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:26:56.000+00:00", + "slug": "contact", + "title": "Contact", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:48.000+00:00", + "url": "http://127.0.0.1:2369/contact/", + "uuid": "1e638bd4-5a16-40b3-bea7-866db1d7419e", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a7b", + "comments": false, + "created_at": "2022-09-13T11:26:48.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "Oh hey, you clicked every link of our starter content and even clicked this small link in the footer! If you like Ghost and you're enjoying the product so far, we'd hugely appreciate your support in any way you care to show it. + +Ghost is a non-profit organization, and we give away all our intellectual property as open source software. If you believe in what we do, there are a number of ways you can give us a hand, and we hugely appreciate all of them: + + * Contribute code via GitHub + * Contribute", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a7b", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:26:58.000+00:00", + "slug": "contribute", + "title": "Contribute", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:48.000+00:00", + "url": "http://127.0.0.1:2369/contribute/", + "uuid": "5952f290-2f04-4a64-aaab-f540dd692653", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a7a", + "comments": false, + "created_at": "2022-09-13T11:26:48.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "Wondering how Ghost fares when it comes to privacy and GDPR rules? Good news: Ghost does not use any tracking cookies of any kind. + +You can integrate any products, services, ads or integrations with Ghost yourself if you want to, but it's always a good idea to disclose how subscriber data will be used by putting together a privacy page.", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a7a", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:26:57.000+00:00", + "slug": "privacy", + "title": "Privacy", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:48.000+00:00", + "url": "http://127.0.0.1:2369/privacy/", + "uuid": "975cba81-9a78-4aff-866a-0af6d1374ab9", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "618ba1ffbe2896088840a6e9", + "comments": false, + "created_at": "2022-09-13T11:26:47.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "Static page test is what this is for. + +Hopefully you don't find it a bore.", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "618ba1ffbe2896088840a6e9", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:26:47.000+00:00", + "slug": "static-page-test", + "title": "This is a static page", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:47.000+00:00", + "url": "http://127.0.0.1:2369/static-page-test/", + "uuid": "cef7fadb-211c-437e-89c3-87e53c5809ad", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632068f94bd39177ff78a8dc", + "comments": false, + "created_at": "2022-09-13T11:26:49.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "markdown +", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632068f94bd39177ff78a8dc", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:27:04.000+00:00", + "slug": "free-to-see", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:49.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "a6b4a357-7bed-4e9e-9292-9639c1f3e2c4", + "visibility": "public", + }, + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632068f94bd39177ff78a8df", + "comments": false, + "created_at": "2022-09-13T11:26:49.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632068f94bd39177ff78a8df", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:27:34.000+00:00", + "slug": "thou-shalt-not-be-seen", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:49.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "e6845019-80b6-40a3-a2b7-0523da09d2a6", + "visibility": "members", + }, + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632068f94bd39177ff78a8e2", + "comments": false, + "created_at": "2022-09-13T11:26:49.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632068f94bd39177ff78a8e2", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:27:19.000+00:00", + "slug": "thou-shalt-be-paid-for", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:49.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "3e780c4f-7e1f-45e8-b6c4-57f0a3763274", + "visibility": "paid", + }, + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632068f94bd39177ff78a8e5", + "comments": false, + "created_at": "2022-09-13T11:26:49.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "excerpt": "", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632068f94bd39177ff78a8e5", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:27:19.000+00:00", + "slug": "thou-shalt-be-for-specific-tiers", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:26:49.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "cb7207b8-05e1-41f6-8c93-4dc237b7bf77", + "visibility": "tiers", + }, + ], +} +`; diff --git a/ghost/core/test/e2e-api/content/__snapshots__/posts.test.js.snap b/ghost/core/test/e2e-api/content/__snapshots__/posts.test.js.snap index 82600c9c49..2bfa07e73d 100644 --- a/ghost/core/test/e2e-api/content/__snapshots__/posts.test.js.snap +++ b/ghost/core/test/e2e-api/content/__snapshots__/posts.test.js.snap @@ -3829,3 +3829,553 @@ Header Level 3 ], } `; + +exports[`Posts Content API Cannot request mobiledoc or lexical formats 1: [body] 1`] = ` +Object { + "meta": Object { + "pagination": Object { + "limit": 15, + "next": null, + "page": 1, + "pages": 1, + "prev": null, + "total": 15, + }, + }, + "posts": Array [ + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632067a7286eb6765f516d56", + "comments": false, + "created_at": "2022-09-13T11:21:11.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632067a7286eb6765f516d56", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:56.000+00:00", + "slug": "thou-shalt-not-be-seen", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:11.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "7cd5f03f-3a8c-4ded-80a6-09a87d11b29a", + "visibility": "members", + }, + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632067a7286eb6765f516d59", + "comments": false, + "created_at": "2022-09-13T11:21:11.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632067a7286eb6765f516d59", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:41.000+00:00", + "slug": "thou-shalt-be-paid-for", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:11.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "48156891-8f55-448a-85f1-379c9114661d", + "visibility": "paid", + }, + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632067a7286eb6765f516d5c", + "comments": false, + "created_at": "2022-09-13T11:21:11.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632067a7286eb6765f516d5c", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:41.000+00:00", + "slug": "thou-shalt-be-for-specific-tiers", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:11.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "a218af49-6809-4635-89ea-70e1aa861633", + "visibility": "tiers", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "632067a7286eb6765f516d53", + "comments": false, + "created_at": "2022-09-13T11:21:11.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "markdown +", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "632067a7286eb6765f516d53", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:26.000+00:00", + "slug": "free-to-see", + "title": "title", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:11.000+00:00", + "url": "http://127.0.0.1:2369/404/", + "uuid": "d0ff6012-9116-4ae2-88a1-d770279a9ca6", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a77", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "We've crammed the most important information to help you get started with Ghost into this one post. It's your cheat-sheet to get started, and your shortcut to advanced features.", + "custom_template": null, + "email_subject": null, + "excerpt": "We've crammed the most important information to help you get started with Ghost into this one post. It's your cheat-sheet to get started, and your shortcut to advanced features.", + "feature_image": "https://static.ghost.org/v4.0.0/images/welcome-to-ghost.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a77", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:15.000+00:00", + "slug": "welcome", + "title": "Start here for a quick overview of everything you need to know", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/welcome/", + "uuid": "1a9aaa35-7f40-40c3-b63e-772e4fd4f2ad", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a76", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "How to tweak a few settings in Ghost to transform your site from a generic template to a custom brand with style and personality.", + "custom_template": null, + "email_subject": null, + "excerpt": "How to tweak a few settings in Ghost to transform your site from a generic template to a custom brand with style and personality.", + "feature_image": "https://static.ghost.org/v4.0.0/images/publishing-options.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a76", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:14.000+00:00", + "slug": "design", + "title": "Customizing your brand and design settings", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/design/", + "uuid": "57bd50a8-3433-43b3-91f8-d2f63bfde7b4", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a75", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "A full overview of all the features built into the Ghost editor, including powerful workflow automations to speed up your creative process.", + "custom_template": null, + "email_subject": null, + "excerpt": "A full overview of all the features built into the Ghost editor, including powerful workflow automations to speed up your creative process.", + "feature_image": "https://static.ghost.org/v4.0.0/images/writing-posts-with-ghost.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a75", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:13.000+00:00", + "slug": "write", + "title": "Writing and managing content in Ghost, an advanced guide", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/write/", + "uuid": "0d4d2a38-3179-431f-b3d4-a183b1ef9721", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a74", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "How Ghost allows you to turn anonymous readers into an audience of active subscribers, so you know what's working and what isn't.", + "custom_template": null, + "email_subject": null, + "excerpt": "How Ghost allows you to turn anonymous readers into an audience of active subscribers, so you know what's working and what isn't.", + "feature_image": "https://static.ghost.org/v4.0.0/images/creating-a-custom-theme.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a74", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:12.000+00:00", + "slug": "portal", + "title": "Building your audience with subscriber signups", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/portal/", + "uuid": "41fce763-92b8-4d94-a055-399bf42af302", + "visibility": "public", + }, + Object { + "access": false, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a73", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "", + "feature_image": "https://static.ghost.org/v4.0.0/images/organizing-your-content.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a73", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:11.000+00:00", + "slug": "sell", + "title": "Selling premium memberships with recurring revenue", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/sell/", + "uuid": "40ca1278-ca7a-4fd9-8ca3-4f8d6b733d13", + "visibility": "paid", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a72", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "A guide to collaborating with other staff users to publish, and some resources to help you with the next steps of growing your business", + "custom_template": null, + "email_subject": null, + "excerpt": "A guide to collaborating with other staff users to publish, and some resources to help you with the next steps of growing your business", + "feature_image": "https://static.ghost.org/v4.0.0/images/admin-settings.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a72", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:10.000+00:00", + "slug": "grow", + "title": "How to grow your business around an audience", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/grow/", + "uuid": "b673fa02-27a6-4835-afcf-f8946dcc31c9", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "6194d3ce51e2700162531a71", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "Work with all your favorite apps and tools or create your own custom integrations using the Ghost API.", + "custom_template": null, + "email_subject": null, + "excerpt": "Work with all your favorite apps and tools or create your own custom integrations using the Ghost API.", + "feature_image": "https://static.ghost.org/v4.0.0/images/app-integrations.png", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "6194d3ce51e2700162531a71", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:09.000+00:00", + "slug": "integrations", + "title": "Setting up apps and custom integrations", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/integrations/", + "uuid": "f7d709d9-f158-4258-b1b9-57d5100ea922", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "618ba1ffbe2896088840a6e7", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": " * Lorem + * Aliquam + * Tortor + * Morbi + * Praesent + * Pellentesque + +Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. + +1234abcdefghijkl + +Definition listConsectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim venia", + "feature_image": null, + "feature_image_alt": null, + "feature_image_caption": null, + "featured": true, + "frontmatter": null, + "id": "618ba1ffbe2896088840a6e7", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2022-09-13T11:21:09.000+00:00", + "slug": "not-so-short-bit-complex", + "title": "Not so short, bit complex", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/not-so-short-bit-complex/", + "uuid": "18ed7005-734e-461f-9d0a-53267725b6d6", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "618ba1ffbe2896088840a6e3", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "testing + + +mctesters + + + * test + * line + * items +", + "feature_image": "http://placekitten.com/500/200", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": true, + "frontmatter": null, + "id": "618ba1ffbe2896088840a6e3", + "meta_description": "meta description for short and sweet", + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2015-01-03T00:00:00.000+00:00", + "slug": "short-and-sweet", + "title": "Short and Sweet", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/short-and-sweet/", + "uuid": "2ac6b4f6-e1f3-406c-9247-c94a0496d39d", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "618ba1ffbe2896088840a6e1", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": null, + "custom_template": null, + "email_subject": null, + "excerpt": "HTML Ipsum Presents + +Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum o", + "feature_image": "http://127.0.0.1:2369/content/images/2018/hey.jpg", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "618ba1ffbe2896088840a6e1", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2015-01-02T00:00:00.000+00:00", + "slug": "ghostly-kitchen-sink", + "title": "Ghostly Kitchen Sink", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:09.000+00:00", + "url": "http://127.0.0.1:2369/ghostly-kitchen-sink/", + "uuid": "a327e4f9-8fb4-413c-95f7-4b596ab794b4", + "visibility": "public", + }, + Object { + "access": true, + "canonical_url": null, + "codeinjection_foot": null, + "codeinjection_head": null, + "comment_id": "618ba1ffbe2896088840a6df", + "comments": false, + "created_at": "2022-09-13T11:21:09.000+00:00", + "custom_excerpt": "This is my custom excerpt!", + "custom_template": null, + "email_subject": null, + "excerpt": "This is my custom excerpt!", + "feature_image": "https://example.com/super_photo.jpg", + "feature_image_alt": null, + "feature_image_caption": null, + "featured": false, + "frontmatter": null, + "id": "618ba1ffbe2896088840a6df", + "meta_description": null, + "meta_title": null, + "og_description": null, + "og_image": null, + "og_title": null, + "published_at": "2015-01-01T00:00:00.000+00:00", + "slug": "html-ipsum", + "title": "HTML Ipsum", + "twitter_description": null, + "twitter_image": null, + "twitter_title": null, + "updated_at": "2022-09-13T11:21:11.000+00:00", + "url": "http://127.0.0.1:2369/html-ipsum/", + "uuid": "2ebd2d59-034d-4af4-b780-809c3e416d9c", + "visibility": "public", + }, + ], +} +`; diff --git a/ghost/core/test/e2e-api/content/pages.test.js b/ghost/core/test/e2e-api/content/pages.test.js index 4b7aca030e..0bf9a49daa 100644 --- a/ghost/core/test/e2e-api/content/pages.test.js +++ b/ghost/core/test/e2e-api/content/pages.test.js @@ -133,4 +133,11 @@ describe('Pages Content API', function () { tiersPostData.tiers.length.should.eql(1); }); + + it('Cannot request mobiledoc or lexical formats', async function () { + await agent + .get(`pages/?formats=mobiledoc,lexical`) + .expectStatus(200) + .matchBodySnapshot(); + }); }); diff --git a/ghost/core/test/e2e-api/content/posts.test.js b/ghost/core/test/e2e-api/content/posts.test.js index 88e404372e..8b86f95712 100644 --- a/ghost/core/test/e2e-api/content/posts.test.js +++ b/ghost/core/test/e2e-api/content/posts.test.js @@ -323,4 +323,11 @@ describe('Posts Content API', function () { .expectStatus(200) .matchBodySnapshot(); }); + + it('Cannot request mobiledoc or lexical formats', async function () { + await agent + .get(`posts/?formats=mobiledoc,lexical`) + .expectStatus(200) + .matchBodySnapshot(); + }); });