From f42119673f166eccb8911fcc9483ce829eb62f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 12 Sep 2017 11:41:52 -0400 Subject: [PATCH] fix string cids in post summaries --- src/posts/summary.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) {