mirror of https://github.com/calzoneman/sync.git
Add an extra check to prevent sticking usernames clientside
This commit is contained in:
parent
3abc7ca0c6
commit
4841e7bc1c
|
@ -652,6 +652,10 @@ Callbacks = {
|
|||
},
|
||||
|
||||
addUser: function(data) {
|
||||
var user = findUserlistItem(data.name);
|
||||
// Remove previous instance of user, if there was one
|
||||
if(user !== null)
|
||||
user.remove();
|
||||
var div = $("<div/>")
|
||||
.addClass("userlist_item");
|
||||
var flair = $("<span/>").appendTo(div);
|
||||
|
|
|
@ -60,9 +60,14 @@ function formatURL(data) {
|
|||
|
||||
function findUserlistItem(name) {
|
||||
var children = $("#userlist .userlist_item");
|
||||
if(children.length == 0)
|
||||
return null;
|
||||
name = name.toLowerCase();
|
||||
for(var i in children) {
|
||||
var child = children[i];
|
||||
if(child.children[1].innerHTML === name)
|
||||
if(typeof child.children === "undefined")
|
||||
continue;
|
||||
if($(child.children[1]).text().toLowerCase() == name)
|
||||
return $(child);
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue