fix to getRecentReplies causing count = 0 to return unlimited

v1.18.x
psychobunny 11 years ago
parent d6c7551120
commit 1d69436b44

@ -217,6 +217,10 @@ var db = require('./database.js'),
};
Categories.getRecentReplies = function(cid, count, callback) {
if(count === 0) {
return callback(null, []);
}
db.getSortedSetRevRange('categories:recent_posts:cid:' + cid, 0, count - 1, function(err, pids) {
if (err) {

@ -55,9 +55,9 @@ var path = require('path'),
});
function iterator(category, callback) {
categories.getRecentReplies(category.cid, category.numRecentTopics, function (err, posts) {
categories.getRecentReplies(category.cid, parseInt(category.numRecentTopics, 10), function (err, posts) {
category.posts = posts;
category.post_count = posts.length > 2 ? 2 : posts.length;
category.post_count = posts.length > 2 ? 2 : posts.length; // this was a hack to make metro work back in the day, post_count should just = length
callback(null);
});
}

Loading…
Cancel
Save