|
|
|
@ -174,9 +174,9 @@ var async = require('async'),
|
|
|
|
|
Topics.getTopicsData(tids, function(err, topics) {
|
|
|
|
|
function mapFilter(array, field) {
|
|
|
|
|
return array.map(function(topic) {
|
|
|
|
|
return topic[field];
|
|
|
|
|
return topic && topic[field];
|
|
|
|
|
}).filter(function(value, index, array) {
|
|
|
|
|
return array.indexOf(value) === index;
|
|
|
|
|
return value && array.indexOf(value) === index;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -219,6 +219,7 @@ var async = require('async'),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (var i=0; i<topics.length; ++i) {
|
|
|
|
|
if (topics[i]) {
|
|
|
|
|
topics[i].category = categories[topics[i].cid];
|
|
|
|
|
topics[i].category.disabled = parseInt(topics[i].category.disabled, 10) === 1;
|
|
|
|
|
topics[i].user = users[topics[i].uid];
|
|
|
|
@ -231,9 +232,10 @@ var async = require('async'),
|
|
|
|
|
topics[i].unread = !(results.hasRead[i] && parseInt(uid, 10) !== 0);
|
|
|
|
|
topics[i].unreplied = parseInt(topics[i].postcount, 10) <= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
topics = topics.filter(function(topic) {
|
|
|
|
|
return !topic.category.disabled &&
|
|
|
|
|
return topic && !topic.category.disabled &&
|
|
|
|
|
(!topic.deleted || (topic.deleted && isAdminOrMod[topic.cid]) ||
|
|
|
|
|
parseInt(topic.uid, 10) === parseInt(uid, 10));
|
|
|
|
|
});
|
|
|
|
|