mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
lint fixes
This commit is contained in:
@@ -331,7 +331,7 @@ define('forum/chats', [
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.warn('[search] Received ' + response.status +', query: ' + query);
|
console.warn('[search] Received ' + response.status);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
|
|||||||
@@ -7,26 +7,22 @@ var meta = require('../../meta');
|
|||||||
var user = require('../../user');
|
var user = require('../../user');
|
||||||
var helpers = require('../helpers');
|
var helpers = require('../helpers');
|
||||||
|
|
||||||
var chatsController = {};
|
var chatsController = module.exports;
|
||||||
|
|
||||||
chatsController.get = function (req, res, callback) {
|
chatsController.get = function (req, res, callback) {
|
||||||
if (parseInt(meta.config.disableChat, 10) === 1) {
|
if (parseInt(meta.config.disableChat, 10) === 1) {
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
var uid;
|
var uid;
|
||||||
var username;
|
|
||||||
var recentChats;
|
var recentChats;
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
async.parallel({
|
user.getUidByUserslug(req.params.userslug, next);
|
||||||
uid: async.apply(user.getUidByUserslug, req.params.userslug),
|
|
||||||
username: async.apply(user.getUsernameByUserslug, req.params.userslug),
|
|
||||||
}, next);
|
|
||||||
},
|
},
|
||||||
function (results, next) {
|
function (_uid, next) {
|
||||||
uid = results.uid;
|
uid = _uid;
|
||||||
username = results.username;
|
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
@@ -65,10 +61,7 @@ chatsController.get = function (req, res, callback) {
|
|||||||
}),
|
}),
|
||||||
}, next);
|
}, next);
|
||||||
},
|
},
|
||||||
], function (err, data) {
|
function (data) {
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
var room = data.room;
|
var room = data.room;
|
||||||
room.messages = data.messages;
|
room.messages = data.messages;
|
||||||
|
|
||||||
@@ -90,7 +83,8 @@ chatsController.get = function (req, res, callback) {
|
|||||||
room.showUserInput = !room.maximumUsersInChatRoom || room.maximumUsersInChatRoom > 2;
|
room.showUserInput = !room.maximumUsersInChatRoom || room.maximumUsersInChatRoom > 2;
|
||||||
|
|
||||||
res.render('chats', room);
|
res.render('chats', room);
|
||||||
});
|
},
|
||||||
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
chatsController.redirectToChat = function (req, res, next) {
|
chatsController.redirectToChat = function (req, res, next) {
|
||||||
@@ -98,14 +92,15 @@ chatsController.redirectToChat = function (req, res, next) {
|
|||||||
if (!req.uid) {
|
if (!req.uid) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
user.getUserField(req.uid, 'userslug', function (err, userslug) {
|
async.waterfall([
|
||||||
if (err || !userslug) {
|
function (next) {
|
||||||
return next(err);
|
user.getUserField(req.uid, 'userslug', next);
|
||||||
|
},
|
||||||
|
function (userslug, next) {
|
||||||
|
if (!userslug) {
|
||||||
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
helpers.redirect(res, '/user/' + userslug + '/chats' + (roomid ? '/' + roomid : ''));
|
helpers.redirect(res, '/user/' + userslug + '/chats' + (roomid ? '/' + roomid : ''));
|
||||||
});
|
},
|
||||||
|
], next);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
module.exports = chatsController;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user