From d2b54ae0f89b71d7cbde8a6c3c03f7b045c7bfb0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 17 Dec 2015 11:47:32 +0200 Subject: [PATCH] display less derpy chat list --- public/src/modules/chat.js | 8 ++++---- src/controllers/accounts/chats.js | 2 +- src/messaging.js | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index d3972e3708..f6159e28e1 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -113,16 +113,16 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra '' : '
' + userObj['icon:text'] + '
') + ' ' + - userObj.username + ''; + roomObj.usernames + ''; } dropdownEl = $('
  • ') .attr('data-roomId', roomObj.roomId) .appendTo(chatsListEl); - roomObj.users.forEach(function(userObj) { - dropdownEl.append(createUserImage(userObj)); - }); + if (roomObj.lastUser) { + dropdownEl.append(createUserImage(roomObj.lastUser)); + } dropdownEl.click(function() { if (!ajaxify.currentPage.match(/^chats\//)) { diff --git a/src/controllers/accounts/chats.js b/src/controllers/accounts/chats.js index 5399d04d66..2c777e7266 100644 --- a/src/controllers/accounts/chats.js +++ b/src/controllers/accounts/chats.js @@ -68,7 +68,7 @@ chatsController.get = function(req, res, callback) { data.rooms = recentChats.rooms; data.nextStart = recentChats.nextStart; data.title = '[[pages:chat, ' + data.usernames + ']]'; - data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:chats]]', url: '/chats'}, {text: data.usernames}]); + data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:chats]]', url: '/chats'}, {text: data.roomId}]); res.render('chats', data); }); diff --git a/src/messaging.js b/src/messaging.js index 784c66dda0..eb254a235b 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -224,7 +224,7 @@ var async = require('async'), } else { next(null, true); } - } + } ], callback); }; @@ -288,6 +288,10 @@ var async = require('async'), data.users = data.users.filter(function(user) { return user && parseInt(user.uid, 10); }); + data.lastUser = data.users[0]; + data.usernames = data.users.map(function(user) { + return user.username; + }).join(', '); return data; });