Skip to content

Node.js based forum software built for the modern web

fix string cids in post summaries

Barış Soner Uşaklıf42119673f16
diff --git a/src/posts/summary.js b/src/posts/summary.js
index 89223e80f9..2274035df4 100644
--- a/src/posts/summary.js
+++ b/src/posts/summary.js
@@ -4,6 +4,7 @@
var async = require('async');
var validator = require('validator');
var S = require('string');
+var _ = require('lodash');
var topics = require('../topics');
var user = require('../user');
@@ -120,11 +121,11 @@ module.exports = function (Posts) {
topic.title = String(topic.title);
topic.deleted = parseInt(topic.deleted, 10) === 1;
}
- return topic && topic.cid;
- }).filter(function (topic, index, array) {
- return topic && array.indexOf(topic) === index;
+ return topic && parseInt(topic.cid, 10);
});
+ cids = _.unique(cids);
+
categories.getCategoriesFields(cids, ['cid', 'name', 'icon', 'slug', 'parentCid', 'bgColor', 'color'], next);
},
function (categoriesData, next) {