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.
This commit is contained in:
Fabien "egg" O'Carroll 2023-02-09 17:50:10 +07:00 committed by Fabien 'egg' O'Carroll
parent 78bebc6279
commit 3df19235b0

View File

@ -155,6 +155,16 @@ module.exports = class MentionsAPI {
let metadata; let metadata;
try { try {
metadata = await this.#webmentionMetadata.fetch(webmention.source); 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) { } catch (err) {
if (!mention) { if (!mention) {
throw err; throw err;