From 33e34ca8644cc95696f738d307e97730d71215ff Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 11 Mar 2014 23:31:23 -0400 Subject: [PATCH] change getRecentPosts to take count --- src/socket.io/posts.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 3f6b9320d0..fedb968522 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -296,8 +296,12 @@ SocketPosts.loadMoreUserPosts = function(socket, data, callback) { }; -SocketPosts.getRecentPosts = function(socket, term, callback) { - posts.getRecentPosts(socket.uid, 0, 19, term, callback); +SocketPosts.getRecentPosts = function(socket, data, callback) { + if(!data || !data.count) { + return callback(new Error('invalid data')); + } + + posts.getRecentPosts(socket.uid, 0, data.count - 1, data.term, callback); };