This commit is contained in:
Baris Usakli
2017-10-30 15:26:12 -04:00
parent 103d9a91a9
commit a500e0019c
10 changed files with 107 additions and 38 deletions

View File

@@ -75,6 +75,10 @@ module.exports = function (Topics) {
var cutoff = params.cutoff || Topics.unreadCutoff();
if (params.cid && !Array.isArray(params.cid)) {
params.cid = [params.cid];
}
async.waterfall([
function (next) {
async.parallel({
@@ -181,10 +185,11 @@ module.exports = function (Topics) {
},
function (results, next) {
var topics = results.topics;
cid = cid && cid.map(String);
tids = topics.filter(function (topic, index) {
return topic && topic.cid &&
(!!results.isTopicsFollowed[index] || results.ignoredCids.indexOf(topic.cid.toString()) === -1) &&
(!cid || parseInt(cid, 10) === parseInt(topic.cid, 10));
(!cid || (cid.length && cid.indexOf(String(topic.cid)) !== -1));
}).map(function (topic) {
return topic.tid;
});