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) {
user.getUsers('users:postcount', 0, 49, function(err, users) {
res.render('admin/users', {
search_display: 'none',
loadmore_display: 'block',
users: users,
yourid: req.user.uid
});
});
getUsers('users:postcount', req, res, next);
};
usersController.sortByReputation = function(req, res, next) {
user.getUsers('users:reputation', 0, 49, function(err, users) {
res.render('admin/users', {
search_display: 'none',
loadmore_display: 'block',
users: users,
yourid: req.user.uid
});
});
getUsers('users:reputation', 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', {
search_display: 'none',
loadmore_display: 'block',
users: users,
yourid: req.user.uid
});
});
};
}
usersController.getCSV = function(req, res, next) {
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('/api/admin/users/search', controllers.admin.users.search);
app.get('/admin/users/latest', middleware.admin.buildHeader, controllers.admin.users.latest);
app.get('/api/admin/users/latest', 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.sortByJoinDate);
app.get('/admin/users/sort-posts', middleware.admin.buildHeader, controllers.admin.users.sortByPosts);
app.get('/api/admin/users/sort-posts', controllers.admin.users.sortByPosts);
@ -76,7 +76,7 @@ module.exports = function(app, middleware, controllers) {
app.all('/api/admin/*', middleware.admin.isAdmin, middleware.prepareAPI);
app.all('/admin/*', middleware.admin.isAdmin);
app.get('/admin', middleware.admin.isAdmin);
mainRoutes(app, middleware, controllers);
userRoutes(app, middleware, controllers);
forumRoutes(app, middleware, controllers);

@ -67,15 +67,8 @@ Sockets.init = function(server) {
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 */
logger.io_one(socket,uid);
logger.io_one(socket, uid);
if (uid) {

Loading…
Cancel
Save