From 3df19235b0e8cdba78b6f58361b5045c9d623607 Mon Sep 17 00:00:00 2001 From: "Fabien \"egg\" O'Carroll" Date: Thu, 9 Feb 2023 17:50:10 +0700 Subject: [PATCH] Added support for updating Mentions when Webmentions are resent refs https://github.com/TryGhost/Team/issues/2535 At the moment we only update the metadata of the Webmention source, so that we can capture update titles, excerpts, etc... when a post is updated. --- ghost/webmentions/lib/MentionsAPI.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ghost/webmentions/lib/MentionsAPI.js b/ghost/webmentions/lib/MentionsAPI.js index 9304d6e70f..a5f510ebdf 100644 --- a/ghost/webmentions/lib/MentionsAPI.js +++ b/ghost/webmentions/lib/MentionsAPI.js @@ -155,6 +155,16 @@ module.exports = class MentionsAPI { let metadata; try { metadata = await this.#webmentionMetadata.fetch(webmention.source); + if (mention) { + mention.setSourceMetadata({ + sourceTitle: metadata.title, + sourceSiteTitle: metadata.siteTitle, + sourceAuthor: metadata.author, + sourceExcerpt: metadata.excerpt, + sourceFavicon: metadata.favicon, + sourceFeaturedImage: metadata.image + }); + } } catch (err) { if (!mention) { throw err;