Sort users

This commit is contained in:
Mattias Erming 2014-07-07 23:52:45 +02:00
parent 85d2ef0d39
commit be45ab45f9

View file

@ -21,5 +21,20 @@ function Chan(attr) {
}
Chan.prototype.sortUsers = function() {
// ..
this.users = _.sortBy(
this.users,
function(u) { return u.name.toLowerCase(); }
);
var modes = [
"~",
"%",
"@",
"+",
].reverse();
modes.forEach(function(mode) {
this.users = _.remove(
this.users,
function(u) { return u.mode == mode; }
).concat(this.users);
}, this);
};