From c3854b786e2a4e55df35fefdc2ac93ea9e993874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 26 Apr 2023 16:16:44 -0400 Subject: [PATCH] feat: closes #11432, use edited time if its greater --- src/controllers/topics.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index dd536cdf12..3b7c42d958 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -207,6 +207,10 @@ async function addTags(topicData, req, res) { } description = description.replace(/\n/g, ' '); + const mainPost = postIndex === 0 && postAtIndex ? + postAtIndex : + await topics.getMainPost(topicData.tid, req.uid); + res.locals.metaTags = [ { name: 'title', @@ -234,7 +238,7 @@ async function addTags(topicData, req, res) { }, { property: 'article:modified_time', - content: utils.toISOString(topicData.lastposttime), + content: utils.toISOString(Math.max(topicData.lastposttime, mainPost && mainPost.edited)), }, { property: 'article:section',