From 868b2ff2b66ecc9d4a8a859fe618d26b1454cb4b Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 14 Mar 2015 20:46:28 -0400 Subject: [PATCH] if no term is passed get count --- src/posts/recent.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/posts/recent.js b/src/posts/recent.js index 4a970a6435..d41ef5342e 100644 --- a/src/posts/recent.js +++ b/src/posts/recent.js @@ -13,16 +13,16 @@ module.exports = function(Posts) { }; Posts.getRecentPosts = function(uid, start, stop, term, callback) { - var since = terms.day; + var min = 0; if (terms[term]) { - since = terms[term]; + min = Date.now() - terms[term]; } var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1; async.waterfall([ function(next) { - db.getSortedSetRevRangeByScore('posts:pid', start, count, '+inf', Date.now() - since, next); + db.getSortedSetRevRangeByScore('posts:pid', start, count, '+inf', min, next); }, function(pids, next) { privileges.posts.filter('read', pids, uid, next);