mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-01 05:12:24 +02:00
5bf205195d
Currently, for join/part/kick/nick/... the server will send an updated list of users and the client will re-render the list entirely. This ends up being a very expensive operation when joined on large channels and causes the client to slow down a lot.
21 lines
452 B
JavaScript
21 lines
452 B
JavaScript
var _ = require("lodash");
|
|
var User = require("../../models/user");
|
|
|
|
module.exports = function(irc, network) {
|
|
var client = this;
|
|
irc.on("names", function(data) {
|
|
var chan = _.findWhere(network.channels, {name: data.channel});
|
|
if (typeof chan === "undefined") {
|
|
return;
|
|
}
|
|
chan.users = [];
|
|
_.each(data.names, function(u) {
|
|
chan.users.push(new User(u));
|
|
});
|
|
chan.sortUsers();
|
|
client.emit("users", {
|
|
chan: chan.id
|
|
});
|
|
});
|
|
};
|