From 0f917635c646cae317b71e53d5b22af68319f85d Mon Sep 17 00:00:00 2001 From: accalia Date: Mon, 14 Mar 2016 10:40:24 -0400 Subject: [PATCH] allow loadMore Calls to fetch page 0 --- src/socket.io/notifications.js | 3 ++- src/socket.io/topics/infinitescroll.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/socket.io/notifications.js b/src/socket.io/notifications.js index e2d7cf3084..121ede2a96 100644 --- a/src/socket.io/notifications.js +++ b/src/socket.io/notifications.js @@ -3,6 +3,7 @@ var async = require('async'); var user = require('../user'); var notifications = require('../notifications'); +var utils = require('../../public/src/utils'); var SocketNotifs = {}; @@ -15,7 +16,7 @@ SocketNotifs.get = function(socket, data, callback) { }; SocketNotifs.loadMore = function(socket, data, callback) { - if (!data || !parseInt(data.after, 10)) { + if (!data || !utils.isNumber(data.after) || parseInt(data.after, 10) < 0) { return callback(new Error('[[error:invalid-data]]')); } if (!socket.uid) { diff --git a/src/socket.io/topics/infinitescroll.js b/src/socket.io/topics/infinitescroll.js index 8cb975c15e..3ffe1c65c8 100644 --- a/src/socket.io/topics/infinitescroll.js +++ b/src/socket.io/topics/infinitescroll.js @@ -88,7 +88,7 @@ module.exports = function(SocketTopics) { }; SocketTopics.loadMoreUnreadTopics = function(socket, data, callback) { - if (!data || !data.after) { + if (!data || !utils.isNumber(data.after) || parseInt(data.after, 10) < 0) { return callback(new Error('[[error:invalid-data]]')); } @@ -99,7 +99,7 @@ module.exports = function(SocketTopics) { }; SocketTopics.loadMoreFromSet = function(socket, data, callback) { - if (!data || !data.after || !data.set) { + if (!data || !utils.isNumber(data.after) || parseInt(data.after, 10) < 0 || !data.set) { return callback(new Error('[[error:invalid-data]]')); }