diff options
author | Simon Bartlett <simon@securitycompass.com> | 2015-01-23 20:56:33 -0500 |
---|---|---|
committer | Simon Bartlett <simon@securitycompass.com> | 2015-01-23 20:56:33 -0500 |
commit | 3c4acef291232c79e34de93c80d03b1c786668ea (patch) | |
tree | 510036324c827025b94ecb7116abbbf263981d5d /app/core | |
parent | 632564a7a8c22ee16d98c4ff374caac163cad9d2 (diff) | |
download | lets-chat-3c4acef291232c79e34de93c80d03b1c786668ea.zip lets-chat-3c4acef291232c79e34de93c80d03b1c786668ea.tar.gz lets-chat-3c4acef291232c79e34de93c80d03b1c786668ea.tar.bz2 |
Cleaning up serialization of objects to JSON
Diffstat (limited to 'app/core')
-rw-r--r-- | app/core/messages.js | 7 | ||||
-rw-r--r-- | app/core/rooms.js | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/app/core/messages.js b/app/core/messages.js index b34deaa..66831eb 100644 --- a/app/core/messages.js +++ b/app/core/messages.js @@ -33,11 +33,8 @@ MessageManager.prototype.create = function(options, cb) { console.error(err); return cb(err); } - message = message.toJSON(); - message.owner = user.toJSON(); - message.room = room.toJSON(); - cb(null, message); - this.core.emit('messages:new', message); + cb(null, message, room, user); + this.core.emit('messages:new', message, room, user); }.bind(this)); }.bind(this)); }.bind(this)); diff --git a/app/core/rooms.js b/app/core/rooms.js index bd09d8c..cebf260 100644 --- a/app/core/rooms.js +++ b/app/core/rooms.js @@ -15,7 +15,7 @@ RoomManager.prototype.create = function(options, cb) { } if (cb) { - room = room.toJSON(); + room = room; cb(null, room); this.core.emit('rooms:new', room); } @@ -47,7 +47,7 @@ RoomManager.prototype.update = function(roomId, options, cb) { console.error(err); return cb(err); } - room = room.toJSON(); + room = room; cb(null, room); this.core.emit('rooms:update', room); |