Skip to content

Node.js based forum software built for the modern web

fix: translate category name in summaries as well

Barış Soner Uşaklıce79524bf9bf
diff --git a/src/posts/summary.js b/src/posts/summary.js
index 1f0df7b04c..6e299e8d9b 100644
--- a/src/posts/summary.js
+++ b/src/posts/summary.js
@@ -10,6 +10,7 @@ const user = require('../user');
const plugins = require('../plugins');
const categories = require('../categories');
const utils = require('../utils');
+const helpers = require('../controllers/helpers');
module.exports = function (Posts) {
Posts.getPostSummaryByPids = async function (pids, uid, options) {
@@ -86,7 +87,9 @@ module.exports = function (Posts) {
if (options.escape) {
post.content = post.content ? validator.escape(String(post.content)) : post.content;
}
-
+ if (post.category) {
+ post.category.name = await helpers.translateEscapedValue(post.category.name);
+ }
return post;
}));
}