mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
use includes instead of indexOf
use _.uniq instead of filter&indexOf
This commit is contained in:
@@ -121,11 +121,7 @@ module.exports = function (Categories) {
|
||||
topic.teaserPid = topic.teaserPid || topic.mainPid;
|
||||
}
|
||||
});
|
||||
var cids = _topicData.map(function (topic) {
|
||||
return topic && topic.cid;
|
||||
}).filter(function (cid, index, array) {
|
||||
return cid && array.indexOf(cid) === index;
|
||||
});
|
||||
var cids = _.uniq(topicData.map(topic => topic && topic.cid).filter(cid => parseInt(cid, 10)));
|
||||
|
||||
async.parallel({
|
||||
categoryData: async.apply(Categories.getCategoriesFields, cids, ['cid', 'parentCid']),
|
||||
|
||||
Reference in New Issue
Block a user