fix string cids in post summaries

v1.18.x
Barış Soner Uşaklı 8 years ago
parent 3872c97bed
commit f42119673f

@ -4,6 +4,7 @@
var async = require('async'); var async = require('async');
var validator = require('validator'); var validator = require('validator');
var S = require('string'); var S = require('string');
var _ = require('lodash');
var topics = require('../topics'); var topics = require('../topics');
var user = require('../user'); var user = require('../user');
@ -120,11 +121,11 @@ module.exports = function (Posts) {
topic.title = String(topic.title); topic.title = String(topic.title);
topic.deleted = parseInt(topic.deleted, 10) === 1; topic.deleted = parseInt(topic.deleted, 10) === 1;
} }
return topic && topic.cid; return topic && parseInt(topic.cid, 10);
}).filter(function (topic, index, array) {
return topic && array.indexOf(topic) === index;
}); });
cids = _.unique(cids);
categories.getCategoriesFields(cids, ['cid', 'name', 'icon', 'slug', 'parentCid', 'bgColor', 'color'], next); categories.getCategoriesFields(cids, ['cid', 'name', 'icon', 'slug', 'parentCid', 'bgColor', 'color'], next);
}, },
function (categoriesData, next) { function (categoriesData, next) {

Loading…
Cancel
Save