Minor bugfix

This commit is contained in:
Mattias Erming 2014-06-21 14:17:59 +02:00
parent 543cab46e4
commit c2ff4566fa
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
var _ = require("lodash"); var _ = require("lodash");
var Chan = require("../models/chan"); var Chan = require("../models/chan");
var Msg = require("../models/msg"); var Msg = require("../models/msg");
var User = require("../models/user");
module.exports = function(client, sockets) { module.exports = function(client, sockets) {
var network = this; var network = this;
@ -16,6 +17,13 @@ module.exports = function(client, sockets) {
chan: chan, 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({ var msg = new Msg({
from: data.nick, from: data.nick,
type: "join", type: "join",