use userCount

v1.18.x
barisusakli 9 years ago
parent 79bcb9be10
commit dcb73f9647

@ -126,6 +126,7 @@ usersController.getUsers = function(set, uid, page, callback) {
loadmore_display: results.usersData.count > (stop - start + 1) ? 'block' : 'hide', loadmore_display: results.usersData.count > (stop - start + 1) ? 'block' : 'hide',
users: results.usersData.users, users: results.usersData.users,
pagination: pagination.create(page, pageCount), pagination: pagination.create(page, pageCount),
userCount: results.usersData.count,
title: setToTitles[set] || '[[pages:users/latest]]', title: setToTitles[set] || '[[pages:users/latest]]',
breadcrumbs: helpers.buildBreadcrumbs(breadcrumbs), breadcrumbs: helpers.buildBreadcrumbs(breadcrumbs),
setName: set, setName: set,
@ -171,16 +172,13 @@ function render(req, res, data, next) {
data.adminInviteOnly = registrationType === 'admin-invite-only'; data.adminInviteOnly = registrationType === 'admin-invite-only';
data['reputation:disabled'] = parseInt(meta.config['reputation:disabled'], 10) === 1; data['reputation:disabled'] = parseInt(meta.config['reputation:disabled'], 10) === 1;
async.parallel({ user.getInvitesNumber(req.uid, function(err, numInvites) {
numInvites: async.apply(user.getInvitesNumber, req.uid),
numUsers: async.apply(user.getUserCount)
}, function(err, meta) {
if (err) { if (err) {
return next(err); return next(err);
} }
res.append('X-Total-Count', meta.numUsers); res.append('X-Total-Count', data.userCount);
data.invites = meta.numInvites; data.invites = numInvites;
res.render('users', data); res.render('users', data);
}); });

@ -33,10 +33,6 @@ var utils = require('../public/src/utils');
require('./user/invite')(User); require('./user/invite')(User);
require('./user/password')(User); require('./user/password')(User);
User.getUserCount = function(callback) {
db.sortedSetCount('username:uid', '-inf', '+inf', callback);
};
User.updateLastOnlineTime = function(uid, callback) { User.updateLastOnlineTime = function(uid, callback) {
callback = callback || function() {}; callback = callback || function() {};
User.getUserFields(uid, ['status', 'lastonline'], function(err, userData) { User.getUserFields(uid, ['status', 'lastonline'], function(err, userData) {

Loading…
Cancel
Save