mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
empty array if not topics in catgory
This commit is contained in:
@@ -93,23 +93,23 @@ var db = require('./database'),
|
||||
topics.getTopicsByTids(tids, cid, uid, next);
|
||||
},
|
||||
function(topics, next) {
|
||||
if (topics && topics.length > 0) {
|
||||
db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
next(null, {
|
||||
topics: topics,
|
||||
nextStart: parseInt(rank, 10) + 1
|
||||
});
|
||||
});
|
||||
} else {
|
||||
next(null, {
|
||||
topics: topics,
|
||||
if (!topics || !topics.length) {
|
||||
return next(null, {
|
||||
topics: [],
|
||||
nextStart: 1
|
||||
});
|
||||
}
|
||||
|
||||
db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
next(null, {
|
||||
topics: topics,
|
||||
nextStart: parseInt(rank, 10) + 1
|
||||
});
|
||||
});
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user