mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: crash if post doesn't have topic data
This commit is contained in:
@@ -18,7 +18,7 @@ module.exports = function (Posts) {
|
||||
const tids = _.uniq(postData.map(post => post && post.tid).filter(Boolean));
|
||||
const topicData = await topics.getTopicsFields(tids, ['cid']);
|
||||
const tidToTopic = _.zipObject(tids, topicData);
|
||||
const cids = postData.map(post => tidToTopic[post.tid].cid);
|
||||
const cids = postData.map(post => tidToTopic[post.tid] && tidToTopic[post.tid].cid);
|
||||
return cids;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user