Skip to content

Node.js based forum software built for the modern web

if no term is passed get count

barisusakli868b2ff2b66e
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);