From 277a5631380ddcc31f95be5ebdb8092408b4db6f Mon Sep 17 00:00:00 2001 From: "Fabien \"egg\" O'Carroll" Date: Fri, 17 Feb 2023 18:38:28 +0700 Subject: [PATCH] Added ability to set verified when instantiating Mention refs https://github.com/TryGhost/Team/issues/2548 We need to be able to do this outside of the verify method so that repository implementations have the ability to create existing instances without running expensive verification checks! --- ghost/webmentions/lib/Mention.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ghost/webmentions/lib/Mention.js b/ghost/webmentions/lib/Mention.js index 48792366e5..a4d51757c2 100644 --- a/ghost/webmentions/lib/Mention.js +++ b/ghost/webmentions/lib/Mention.js @@ -166,6 +166,7 @@ module.exports = class Mention { this.#timestamp = data.timestamp; this.#payload = data.payload; this.#resourceId = data.resourceId; + this.#verified = data.verified; } /** @@ -223,6 +224,10 @@ module.exports = class Mention { let payload; payload = data.payload ? JSON.parse(JSON.stringify(data.payload)) : null; + /** @type boolean */ + let verified; + verified = isNew ? false : !!data.verified; + /** @type {ObjectID | null} */ let resourceId = null; if (data.resourceId) { @@ -239,7 +244,8 @@ module.exports = class Mention { target, timestamp, payload, - resourceId + resourceId, + verified }); mention.setSourceMetadata(data);