From 6d5a2635baa71b8c50e8c6124b3c2116f54605e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 8 May 2023 11:40:27 -0400 Subject: [PATCH] parse topic titles for post summaries --- src/posts/summary.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/posts/summary.js b/src/posts/summary.js index 82468a17d5..961c96455f 100644 --- a/src/posts/summary.js +++ b/src/posts/summary.js @@ -80,10 +80,19 @@ module.exports = function (Posts) { 'uid', 'tid', 'title', 'cid', 'tags', 'slug', 'deleted', 'scheduled', 'postcount', 'mainPid', 'teaserPid', ]); + async function parseTitles() { + await Promise.all(topicsData.map(async (t) => { + t.title = await plugins.hooks.fire('filter:parse.raw', t.title); + })); + } + const cids = _.uniq(topicsData.map(topic => topic && topic.cid)); - const categoriesData = await categories.getCategoriesFields(cids, [ - 'cid', 'name', 'icon', 'slug', 'parentCid', - 'bgColor', 'color', 'backgroundImage', 'imageClass', + const [categoriesData] = await Promise.all([ + categories.getCategoriesFields(cids, [ + 'cid', 'name', 'icon', 'slug', 'parentCid', + 'bgColor', 'color', 'backgroundImage', 'imageClass', + ]), + parseTitles(), ]); return { topics: topicsData, categories: categoriesData }; }