From 3f5ec309e9254ac7f10b973390057298e20abb17 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 23 Apr 2013 13:47:09 -0500 Subject: [PATCH] Tweak ACL behaviour ACL is only updated when you first join, when someone's rank changes, or if you click the Channel Ranks tab --- channel.js | 9 +++++---- user.js | 6 ++++++ www/assets/js/client.js | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/channel.js b/channel.js index 4f0b3abf..be1f1d04 100644 --- a/channel.js +++ b/channel.js @@ -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]); } } diff --git a/user.js b/user.js index 1a626a46..d693afd2 100644 --- a/user.js +++ b/user.js @@ -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); diff --git a/www/assets/js/client.js b/www/assets/js/client.js index a1f1c6a4..08873afc 100644 --- a/www/assets/js/client.js +++ b/www/assets/js/client.js @@ -432,6 +432,7 @@ $("#show_acl").click(function() { $(".modonly").hide(); $("#show_acl").parent().addClass("active"); $("#channelranks").show(); + socket.emit("requestAcl"); }); function searchLibrary() {