dont make a copy of chat message

This commit is contained in:
barisusakli
2014-09-02 15:50:02 -04:00
parent c56a7bf475
commit e495db3065
3 changed files with 6 additions and 8 deletions

View File

@@ -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
});
});
});