From d1989babf55e78469dcca5c895d83a457287ff69 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 22 Sep 2016 20:00:39 +0300 Subject: [PATCH] closes #5044 --- src/controllers/accounts/chats.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/controllers/accounts/chats.js b/src/controllers/accounts/chats.js index c6ff2886c1..35eab94a83 100644 --- a/src/controllers/accounts/chats.js +++ b/src/controllers/accounts/chats.js @@ -15,14 +15,19 @@ chatsController.get = function(req, res, callback) { return callback(); } var uid; + var username; var recentChats; async.waterfall([ 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) { - uid = _uid; + function(results, next) { + uid = results.uid; + username = results.username; if (!uid) { return callback(); } @@ -38,7 +43,7 @@ chatsController.get = function(req, res, callback) { nextStart: recentChats.nextStart, allowed: true, 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); @@ -75,7 +80,11 @@ chatsController.get = function(req, res, callback) { room.userslug = req.params.userslug; room.nextStart = recentChats.nextStart; 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.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000; room.showUserInput = !room.maximumUsersInChatRoom || room.maximumUsersInChatRoom > 2;