v1.18.x
barisusakli 8 years ago
parent a6c3be0bb1
commit d1989babf5

@ -15,14 +15,19 @@ chatsController.get = function(req, res, callback) {
return callback(); return callback();
} }
var uid; var uid;
var username;
var recentChats; var recentChats;
async.waterfall([ async.waterfall([
function(next) { function(next) {
user.getUidByUserslug(req.params.userslug, next); async.parallel({
uid: async.apply(user.getUidByUserslug, req.params.userslug),
username: async.apply(user.getUsernameByUserslug, req.params.userslug)
}, next);
}, },
function(_uid, next) { function(results, next) {
uid = _uid; uid = results.uid;
username = results.username;
if (!uid) { if (!uid) {
return callback(); return callback();
} }
@ -38,7 +43,7 @@ chatsController.get = function(req, res, callback) {
nextStart: recentChats.nextStart, nextStart: recentChats.nextStart,
allowed: true, allowed: true,
title: '[[pages:chats]]', title: '[[pages:chats]]',
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[pages:chats]]'}]) breadcrumbs: helpers.buildBreadcrumbs([{text: username, url: '/user/' + req.params.userslug}, {text: '[[pages:chats]]'}])
}); });
} }
messaging.isUserInRoom(req.uid, req.params.roomid, next); messaging.isUserInRoom(req.uid, req.params.roomid, next);
@ -75,7 +80,11 @@ chatsController.get = function(req, res, callback) {
room.userslug = req.params.userslug; room.userslug = req.params.userslug;
room.nextStart = recentChats.nextStart; room.nextStart = recentChats.nextStart;
room.title = room.roomName; room.title = room.roomName;
room.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:chats]]', url: '/chats'}, {text: room.roomName}]); room.breadcrumbs = helpers.buildBreadcrumbs([
{text: username, url: '/user/' + req.params.userslug},
{text: '[[pages:chats]]', url: '/user/' + req.params.userslug + '/chats'},
{text: room.roomName}
]);
room.maximumUsersInChatRoom = parseInt(meta.config.maximumUsersInChatRoom, 10) || 0; room.maximumUsersInChatRoom = parseInt(meta.config.maximumUsersInChatRoom, 10) || 0;
room.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000; room.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000;
room.showUserInput = !room.maximumUsersInChatRoom || room.maximumUsersInChatRoom > 2; room.showUserInput = !room.maximumUsersInChatRoom || room.maximumUsersInChatRoom > 2;

Loading…
Cancel
Save