mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
fixed getCidsByPids
This commit is contained in:
@@ -408,17 +408,18 @@ var async = require('async'),
|
|||||||
var tids = posts.map(function(post) {
|
var tids = posts.map(function(post) {
|
||||||
return post.tid;
|
return post.tid;
|
||||||
}).filter(function(tid, index, array) {
|
}).filter(function(tid, index, array) {
|
||||||
return array.indexOf(tid) === index;
|
return tid && array.indexOf(tid) === index;
|
||||||
});
|
});
|
||||||
|
|
||||||
topics.getTopicsFields(tids, ['cid'], function(err, topics) {
|
topics.getTopicsFields(tids, ['cid'], function(err, topics) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
var map = {};
|
var map = {};
|
||||||
topics.forEach(function(topic) {
|
topics.forEach(function(topic, index) {
|
||||||
if (topic) {
|
if (topic) {
|
||||||
map[topic.tid] = topic.cid;
|
map[tids[index]] = topic.cid;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user