Tweak ACL behaviour

ACL is only updated when you first join, when someone's rank changes, or if
you click the Channel Ranks tab
This commit is contained in:
calzoneman 2013-04-23 13:47:09 -05:00
parent ce84b30354
commit 3f5ec309e9
3 changed files with 12 additions and 4 deletions

View file

@ -388,6 +388,10 @@ Channel.prototype.sendRankStuff = function(user) {
}
user.socket.emit("chatFilters", {filters: filts});
}
this.sendACL(user);
}
Channel.prototype.sendACL = function(user) {
if(Rank.hasPermission(user, "acl")) {
user.socket.emit("acl", Database.getChannelRanks(this.name));
}
@ -453,7 +457,6 @@ Channel.prototype.broadcastNewUser = function(user) {
this.sendRankStuff(user);
if(user.rank > Rank.Guest) {
this.saveRank(user);
this.broadcastRankTable();
}
}
@ -504,9 +507,7 @@ Channel.prototype.broadcastBanlist = function() {
Channel.prototype.broadcastRankTable = function() {
var ranks = Database.getChannelRanks(this.name);
for(var i = 0; i < this.users.length; i++) {
if(Rank.hasPermission(this.users[i], "acl")) {
this.users[i].socket.emit("acl", ranks);
}
this.sendACL(this.users[i]);
}
}

View file

@ -255,6 +255,12 @@ User.prototype.initCallbacks = function() {
}
}.bind(this));
this.socket.on("requestAcl", function() {
if(this.channel != null) {
this.channel.sendACL(this);
}
}.bind(this));
this.socket.on("voteskip", function(data) {
if(this.channel != null) {
this.channel.tryVoteskip(this);

View file

@ -432,6 +432,7 @@ $("#show_acl").click(function() {
$(".modonly").hide();
$("#show_acl").parent().addClass("active");
$("#channelranks").show();
socket.emit("requestAcl");
});
function searchLibrary() {