diff --git a/src/controllers/users.js b/src/controllers/users.js index c3dc8b0550..c84de75b5b 100644 --- a/src/controllers/users.js +++ b/src/controllers/users.js @@ -126,6 +126,7 @@ usersController.getUsers = function(set, uid, page, callback) { loadmore_display: results.usersData.count > (stop - start + 1) ? 'block' : 'hide', users: results.usersData.users, pagination: pagination.create(page, pageCount), + userCount: results.usersData.count, title: setToTitles[set] || '[[pages:users/latest]]', breadcrumbs: helpers.buildBreadcrumbs(breadcrumbs), setName: set, @@ -171,16 +172,13 @@ function render(req, res, data, next) { data.adminInviteOnly = registrationType === 'admin-invite-only'; data['reputation:disabled'] = parseInt(meta.config['reputation:disabled'], 10) === 1; - async.parallel({ - numInvites: async.apply(user.getInvitesNumber, req.uid), - numUsers: async.apply(user.getUserCount) - }, function(err, meta) { + user.getInvitesNumber(req.uid, function(err, numInvites) { if (err) { return next(err); } - res.append('X-Total-Count', meta.numUsers); - data.invites = meta.numInvites; + res.append('X-Total-Count', data.userCount); + data.invites = numInvites; res.render('users', data); }); diff --git a/src/middleware/cls.js b/src/middleware/cls.js index 0118fa998f..8cf0062d30 100644 --- a/src/middleware/cls.js +++ b/src/middleware/cls.js @@ -29,7 +29,7 @@ var namespace = continuationLocalStorage.createNamespace(APP_NAMESPACE); }; cls.setItem = cls.set; - cls.getItem = cls.set; + cls.getItem = cls.get; cls.namespace = namespace; cls.continuationLocalStorage = continuationLocalStorage; diff --git a/src/user.js b/src/user.js index b222ae4a2b..c7fb18e4fc 100644 --- a/src/user.js +++ b/src/user.js @@ -33,10 +33,6 @@ var utils = require('../public/src/utils'); require('./user/invite')(User); require('./user/password')(User); - User.getUserCount = function(callback) { - db.sortedSetCount('username:uid', '-inf', '+inf', callback); - }; - User.updateLastOnlineTime = function(uid, callback) { callback = callback || function() {}; User.getUserFields(uid, ['status', 'lastonline'], function(err, userData) {