summaryrefslogtreecommitdiff
path: root/src/static
diff options
context:
space:
mode:
authorMikk Andresen <mikk.andresen@gmail.com>2016-01-05 18:22:32 +0200
committerMikk Andresen <mikk.andresen@gmail.com>2016-01-05 18:22:32 +0200
commitccbcf0ddce492235117cbac9d81d52b82dcdc340 (patch)
tree6b7acc9b9bc99e5758e4d4224497a58ad06e7987 /src/static
parentaab71864865b28d3b141153d3d52d8625cf18289 (diff)
downloadetherpad-lite-ccbcf0ddce492235117cbac9d81d52b82dcdc340.zip
Add usersOnline function to pad_userlist, fix a bug where several occurances of current user were pushed to users list.
Diffstat (limited to 'src/static')
-rw-r--r--src/static/js/pad_userlist.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/static/js/pad_userlist.js b/src/static/js/pad_userlist.js
index 22dab40a..7ac960d0 100644
--- a/src/static/js/pad_userlist.js
+++ b/src/static/js/pad_userlist.js
@@ -508,12 +508,18 @@ var paduserlist = (function()
});
//
},
- users: function(){
- // Returns an object of users who have been on this pad
- // Firstly we have to get live data..
- var userList = otherUsersInfo;
+ usersOnline: function()
+ {
+ // Returns an object of users who are currently online on this pad
+ var userList = [].concat(otherUsersInfo); // Make a copy of the otherUsersInfo, otherwise every call to users modifies the referenced array
// Now we need to add ourselves..
userList.push(myUserInfo);
+ return userList;
+ },
+ users: function(){
+ // Returns an object of users who have been on this pad
+ var userList = self.usersOnline();
+
// Now we add historical authors
var historical = clientVars.collab_client_vars.historicalAuthorData;
for (var key in historical){
@@ -528,7 +534,6 @@ var paduserlist = (function()
if(exists === false){
userList.push(historical[key]);
}
-
}
return userList;
},