prevent duplicated usernames in friend box

This commit is contained in:
Thibault Duplessis 2013-05-29 22:00:14 +02:00
parent 20f0949587
commit 0742f66f87
2 changed files with 8 additions and 10 deletions

View file

@ -1265,28 +1265,26 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
this.$nbTotal = this.element.find('.title .total');
this.$list = this.element.find("div.list");
this.$nobody = this.element.find("div.nobody");
this.nb = 0;
this.set(this.element.data('preload'));
},
repaint: function() {
var onlineNb = this.$list.children().length;
this.$nbOnline.text(onlineNb);
this.users = _.uniq(this.users);
this.$nbOnline.text(this.users.length);
this.$nbTotal.text(this.nb);
this.$nobody.toggle(onlineNb == 0);
this.$nobody.toggle(this.users.length == 0);
this.$list.html(_.map(this.users, this._renderUser).join(""));
},
set: function(data) {
this.nb = data['nb'];
this.$list.html(_.map(data['us'], this._renderUser).join(""));
this.users = data['us'];
this.repaint();
},
enters: function(user) {
this.$list.append(this._renderUser(user));
this.users.push(user);
this.repaint();
},
leaves: function(user) {
this.$list.children().filter(function() {
return $(this).text() == user;
}).remove();
this.users = _.without(this.users, user);
this.repaint();
},
_renderUser: function(user) {

2
todo
View file

@ -73,7 +73,7 @@ search bug http://fr.lichess.org/forum/search?text=user:aybabtu
hooks do not always disappear
don't show team leaders activity in mod logs
LilaError['[analysis] fred65 already analyses ueogn4fr, won't process ueogn4fr']
1024 compat (timeline)
1024 compat (timeline) and http://ft.trillian.im/785abe041074fd64135ab3318aff1ec8767ab03d/6gZ41ZXugNdywSLY0JSQiVm7y6aeh.jpg
DEPLOY p21
----------