From c6b90b6ac7c6490104b5b64cc6a7518680201007 Mon Sep 17 00:00:00 2001 From: "Fabien \"egg\" O'Carroll" Date: Thu, 16 Feb 2023 14:23:59 +0700 Subject: [PATCH] Added verified property to Mentions Admin API closes https://github.com/TryGhost/Team/issues/2551 Rather than blindly passing all data through the API we explicitly include each new property. This allows us to make changes to the core entities without affecting the API. The verified property is being added now to give design the ability to display these mentions differently. We also needed to include the verified property in the return value of toJSON, this was missed as part of the original entity changes --- .../api/endpoints/utils/serializers/output/mappers/mentions.js | 3 ++- .../test/e2e-api/admin/__snapshots__/mentions.test.js.snap | 2 ++ ghost/webmentions/lib/Mention.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js b/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js index 9c9eb1a05d..adea585fcb 100644 --- a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js +++ b/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js @@ -13,6 +13,7 @@ module.exports = (model) => { source_excerpt: json.sourceExcerpt, source_author: json.sourceAuthor, source_favicon: json.sourceFavicon, - source_featured_image: json.sourceFeaturedImage + source_featured_image: json.sourceFeaturedImage, + verified: json.verified }; }; diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/mentions.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/mentions.test.js.snap index 6c98dd3b82..d7be69a6e5 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/mentions.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/mentions.test.js.snap @@ -16,6 +16,7 @@ Object { "source_title": Any, "target": Any, "timestamp": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, + "verified": false, }, Object { "id": StringMatching /\\[a-f0-9\\]\\{24\\}/, @@ -30,6 +31,7 @@ Object { "source_title": Any, "target": Any, "timestamp": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, + "verified": false, }, ], "meta": Object { diff --git a/ghost/webmentions/lib/Mention.js b/ghost/webmentions/lib/Mention.js index 7b52cbce82..48792366e5 100644 --- a/ghost/webmentions/lib/Mention.js +++ b/ghost/webmentions/lib/Mention.js @@ -153,7 +153,8 @@ module.exports = class Mention { sourceAuthor: this.sourceAuthor, sourceExcerpt: this.sourceExcerpt, sourceFavicon: this.sourceFavicon, - sourceFeaturedImage: this.sourceFeaturedImage + sourceFeaturedImage: this.sourceFeaturedImage, + verified: this.verified }; }