Skip to content

Node.js based forum software built for the modern web

change getRecentPosts to take count

barisusakli33e34ca8644c
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);
};