Lazily load user list
This commit is contained in:
parent
7af573fd96
commit
d06c279f02
@ -144,7 +144,7 @@ function renderChannelMessages(data) {
|
||||
function renderChannelUsers(data) {
|
||||
const users = chat.find("#chan-" + data.id).find(".users");
|
||||
const nicks = data.users
|
||||
.concat()
|
||||
.concat() // Make a copy of the user list, sort is applied in-place
|
||||
.sort((a, b) => b.lastMessage - a.lastMessage)
|
||||
.map((a) => a.nick);
|
||||
|
||||
@ -179,7 +179,13 @@ function renderNetworks(data) {
|
||||
channels: channels
|
||||
})
|
||||
);
|
||||
channels.forEach(renderChannel);
|
||||
channels.forEach((channel) => {
|
||||
renderChannel(channel);
|
||||
|
||||
if (channel.type === "channel") {
|
||||
chat.find("#chan-" + channel.id).data("needsNamesRefresh", true);
|
||||
}
|
||||
});
|
||||
|
||||
utils.confirmExit();
|
||||
sorting();
|
||||
|
@ -108,6 +108,7 @@ Chan.prototype.getMode = function(name) {
|
||||
|
||||
Chan.prototype.toJSON = function() {
|
||||
var clone = _.clone(this);
|
||||
clone.users = []; // Do not send user list, the client will explicitly request it when needed
|
||||
clone.messages = clone.messages.slice(-100);
|
||||
return clone;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user