controllers/admin/users cleanup

v1.18.x
barisusakli 11 years ago
parent ea4931fa1d
commit 46a475fdde

@ -13,48 +13,31 @@ usersController.search = function(req, res, next) {
}); });
}; };
usersController.latest = function(req, res, next) {
user.getUsers('users:joindate', 0, 49, function(err, users) {
res.render('admin/users', {
search_display: 'none',
loadmore_display: 'block',
users: users,
yourid: req.user.uid
});
});
};
usersController.sortByPosts = function(req, res, next) { usersController.sortByPosts = function(req, res, next) {
user.getUsers('users:postcount', 0, 49, function(err, users) { getUsers('users:postcount', req, res, next);
res.render('admin/users', {
search_display: 'none',
loadmore_display: 'block',
users: users,
yourid: req.user.uid
});
});
}; };
usersController.sortByReputation = function(req, res, next) { usersController.sortByReputation = function(req, res, next) {
user.getUsers('users:reputation', 0, 49, function(err, users) { getUsers('users:reputation', req, res, next);
res.render('admin/users', {
search_display: 'none',
loadmore_display: 'block',
users: users,
yourid: req.user.uid
});
});
}; };
usersController.sortByJoinDate = function(req, res, next) { usersController.sortByJoinDate = function(req, res, next) {
user.getUsers('users:joindate', 0, 49, function(err, users) { getUsers('users:joindate', req, res, next);
};
function getUsers(set, req, res, next) {
user.getUsers(set, 0, 49, function(err, users) {
if (err) {
return next(err);
}
res.render('admin/users', { res.render('admin/users', {
search_display: 'none', search_display: 'none',
loadmore_display: 'block',
users: users, users: users,
yourid: req.user.uid yourid: req.user.uid
}); });
}); });
}; }
usersController.getCSV = function(req, res, next) { usersController.getCSV = function(req, res, next) {
user.getUsersCSV(function(err, data) { user.getUsersCSV(function(err, data) {

@ -26,8 +26,8 @@ function userRoutes(app, middleware, controllers) {
app.get('/admin/users/search', middleware.admin.buildHeader, controllers.admin.users.search); app.get('/admin/users/search', middleware.admin.buildHeader, controllers.admin.users.search);
app.get('/api/admin/users/search', controllers.admin.users.search); app.get('/api/admin/users/search', controllers.admin.users.search);
app.get('/admin/users/latest', middleware.admin.buildHeader, controllers.admin.users.latest); app.get('/admin/users/latest', middleware.admin.buildHeader, controllers.admin.users.sortByJoinDate);
app.get('/api/admin/users/latest', controllers.admin.users.latest); app.get('/api/admin/users/latest', controllers.admin.users.sortByJoinDate);
app.get('/admin/users/sort-posts', middleware.admin.buildHeader, controllers.admin.users.sortByPosts); app.get('/admin/users/sort-posts', middleware.admin.buildHeader, controllers.admin.users.sortByPosts);
app.get('/api/admin/users/sort-posts', controllers.admin.users.sortByPosts); app.get('/api/admin/users/sort-posts', controllers.admin.users.sortByPosts);

@ -67,13 +67,6 @@ Sockets.init = function(server) {
socket.uid = parseInt(uid, 10); socket.uid = parseInt(uid, 10);
/* Need to save some state for the logger & maybe some other modules later on */
socket.state = {
user : {
uid : uid
}
};
/* If meta.config.loggerIOStatus > 0, logger.io_one will hook into this socket */ /* If meta.config.loggerIOStatus > 0, logger.io_one will hook into this socket */
logger.io_one(socket, uid); logger.io_one(socket, uid);

Loading…
Cancel
Save