v1.18.x
Julian Lam 9 years ago
parent 46571ccd77
commit 0b735fad17

@ -48,8 +48,8 @@
"nodebb-plugin-spam-be-gone": "0.4.5",
"nodebb-rewards-essentials": "0.0.6",
"nodebb-theme-lavender": "3.0.2",
"nodebb-theme-persona": "4.0.41",
"nodebb-theme-vanilla": "5.0.16",
"nodebb-theme-persona": "4.0.42",
"nodebb-theme-vanilla": "5.0.17",
"nodebb-widget-essentials": "2.0.5",
"nodemailer": "0.7.1",
"npm": "^2.1.4",

@ -263,6 +263,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.addSocketListeners = function() {
socket.on('event:chats.receive', function(data) {
console.log(data);
if (Chats.isCurrentChat(data.withUid)) {
newMessage = data.self === 0;
data.message.self = data.self;
@ -270,18 +271,22 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.appendChatMessage($('.expanded-chat .chat-content'), data.message);
} else {
var contactEl = $('[component="chat/recent"] li[data-uid="' + data.withUid + '"]'),
userKey = data.withUid === data.message.fromuid ? 'fromUser' : 'toUser';
userKey = parseInt(data.withUid, 10) === parseInt(data.message.fromuid, 10) ? 'fromUser' : 'toUser';
// Spawn a new contact if required
templates.parse('partials/chat_contact', {
uid: data.withUid,
templates.parse('partials/chat_contacts', {
contacts: [{
uid: data.message[userKey].uid,
username: data.message[userKey].username,
status: data.message[userKey].status,
picture: data.message[userKey].picture,
'icon:text': data.message[userKey]['icon:text'],
'icon:bgColor': data.message[userKey]['icon:bgColor'],
teaser: {
content: data.message.cleanedContent,
timestampISO: new Date(Date.now()).toISOString()
}
}]
}, function(html) {
translator.translate(html, function(translatedHTML) {
if (contactEl.length) {

Loading…
Cancel
Save