From f9572cc5c739346c61980fd910773ba9e8d4cd1d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 15 Apr 2014 14:39:09 -0400 Subject: [PATCH] fixes chat messages --- src/messaging.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/messaging.js b/src/messaging.js index c2491c8554..49426d971c 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -77,8 +77,9 @@ var db = require('./database'), } async.map(messages, function(message, next) { - message.fromUser = userData[0]; - message.toUser = userData[1]; + var self = parseInt(message.fromuid, 10) === parseInt(fromuid) + message.fromUser = self ? userData[0] : userData[1]; + message.toUser = self ? userData[1] : userData[0]; Messaging.parse(message.content, message.fromuid, fromuid, userData[1], userData[0], isNew, function(result) { message.content = result;