dont make a copy of chat message

v1.18.x
barisusakli 11 years ago
parent c56a7bf475
commit e495db3065

@ -91,7 +91,7 @@ define('forum/chats', ['string', 'sounds'], function(S, sounds) {
containerEl = $('.expanded-chat ul');
if (Chats.isCurrentChat(data.withUid)) {
newMessage = data.message.self === 0;
newMessage = data.self === 0;
Chats.parseMessage(data.message, function(html) {
var newMessage = $(html);

@ -66,7 +66,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar,
if (isSelf) {
username = data.message.toUser.username;
}
newMessage = data.message.self === 0;
newMessage = data.self === 0;
if (module.modalExists(data.withUid)) {
var modal = module.getModal(data.withUid);
module.appendChatMessage(modal, data.message);

@ -202,16 +202,13 @@ SocketModules.chats.send = function(socket, data, callback) {
sendChatNotification(socket.uid, touid, message);
// After-the-fact fixing of the "self" property for the message that goes to the receipient
var recipMessage = JSON.parse(JSON.stringify(message));
recipMessage.self = 0;
// Recipient
SocketModules.chats.pushUnreadCount(touid);
server.getUserSockets(touid).forEach(function(s) {
s.emit('event:chats.receive', {
withUid: socket.uid,
message: recipMessage
message: recipMessage,
self: 0
});
});
@ -220,7 +217,8 @@ SocketModules.chats.send = function(socket, data, callback) {
server.getUserSockets(socket.uid).forEach(function(s) {
s.emit('event:chats.receive', {
withUid: touid,
message: message
message: message,
self: 1
});
});
});

Loading…
Cancel
Save