filter absent users from the userlist

This commit is contained in:
ansuz 2016-10-24 15:11:19 +02:00
parent ac3ddbab70
commit c858b247c1
2 changed files with 22 additions and 2 deletions

View File

@ -112,9 +112,18 @@ define([
editor.setOption('readOnly', !bool);
};
var userList = {}; // List of pretty name of all users (mapped with their server ID)
var userList = module.userList = {}; // List of pretty name of all users (mapped with their server ID)
var toolbarList; // List of users still connected to the channel (server IDs)
var addToUserList = function(data) {
var users = module.users;
if (users && users.length) {
for (var userKey in userList) {
if (users.indexOf(userKey) === -1) {
delete userList[userKey];
}
}
}
for (var attrname in data) { userList[attrname] = data[attrname]; }
if(toolbarList && typeof toolbarList.onChange === "function") {
toolbarList.onChange(userList);
@ -502,6 +511,7 @@ define([
var onReady = config.onReady = function (info) {
var realtime = module.realtime = info.realtime;
module.users = info.userList.users;
module.patchText = TextPatcher.create({
realtime: realtime,
//logging: true

View File

@ -149,9 +149,18 @@ define([
editor.setOption('readOnly', !bool);
};
var userList = {}; // List of pretty name of all users (mapped with their server ID)
var userList = module.userList = {}; // List of pretty name of all users (mapped with their server ID)
var toolbarList; // List of users still connected to the channel (server IDs)
var addToUserList = function(data) {
var users = module.users;
if (users && users.length) {
for (var userKey in userList) {
if (users.indexOf(userKey) === -1) {
delete userList[userKey];
}
}
}
for (var attrname in data) { userList[attrname] = data[attrname]; }
if(toolbarList && typeof toolbarList.onChange === "function") {
toolbarList.onChange(userList);
@ -592,6 +601,7 @@ define([
var onReady = config.onReady = function (info) {
var realtime = module.realtime = info.realtime;
module.users = info.userList.users;
module.patchText = TextPatcher.create({
realtime: realtime,
//logging: true