From c2ff4566faddbb0a3cdbc8d39c48d716d5787184 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Sat, 21 Jun 2014 14:17:59 +0200 Subject: [PATCH] Minor bugfix --- lib/plugins/join.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/plugins/join.js b/lib/plugins/join.js index b4f46fb7..15cd80ee 100644 --- a/lib/plugins/join.js +++ b/lib/plugins/join.js @@ -1,6 +1,7 @@ var _ = require("lodash"); var Chan = require("../models/chan"); var Msg = require("../models/msg"); +var User = require("../models/user"); module.exports = function(client, sockets) { var network = this; @@ -16,6 +17,13 @@ module.exports = function(client, sockets) { chan: chan, }); } + var users = chan.users; + users.push(new User({name: data.nick})); + chan.sortUsers(); + sockets.in("chat").emit("users", { + id: chan.id, + users: users, + }); var msg = new Msg({ from: data.nick, type: "join",