feat(socket.io-groups): Allow first page of members to be retrieved via websockets

previously requesting the first page of members of a group failed
v1.18.x
Accalia de Elementia 9 years ago
parent 6c11709cf1
commit 413517a084

@ -5,6 +5,7 @@ var async = require('async'),
groups = require('../groups'),
meta = require('../meta'),
user = require('../user'),
utils = require('../../../public/src/utils'),
groupsController = require('../controllers/groups'),
SocketGroups = {};
@ -232,7 +233,7 @@ SocketGroups.searchMembers = function(socket, data, callback) {
};
SocketGroups.loadMoreMembers = function (socket, data, callback) {
if (!data.groupName || !parseInt(data.after, 10)) {
if (!data.groupName || !utils.isNumber(data.after) || parseInt(data.after, 10) < 0) {
return callback(new Error('[[error:invalid-data]]'));
}
data.after = parseInt(data.after, 10);
@ -241,7 +242,10 @@ SocketGroups.loadMoreMembers = function(socket, data, callback) {
return callback(err);
}
callback(null, {users: users, nextStart: data.after + 10});
callback(null, {
users: users,
nextStart: data.after + 10
});
});
};

Loading…
Cancel
Save