From 681911ffb176ceca00273a1254821edb744110d4 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Fri, 15 Nov 2013 10:24:43 -0600 Subject: [PATCH] Fix #307 --- lib/channel.js | 2 +- www/assets/js/callbacks.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index 2563917b..5eff2676 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -2370,7 +2370,7 @@ Channel.prototype.changeLeader = function(name) { old.rank = old.oldrank; } this.sendAll("setUserRank", { - name: name, + name: old.name, rank: old.rank }); } diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 2393ee9a..e12cc405 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -533,7 +533,7 @@ Callbacks = { setChannelRank: function(data) { var ents = $("#channelranks").data("entries"); - if(typeof ents === "undefined") + if(typeof ents === "undefined" || ents === null) return; for(var i = 0; i < ents.length; i++) { if(ents[i].name == data.user) { @@ -724,8 +724,10 @@ Callbacks = { if(LEADTMR) clearInterval(LEADTMR); LEADTMR = setInterval(sendVideoUpdate, 5000); - } else { + handlePermissionChange(); + } else if (CLIENT.leader) { CLIENT.leader = false; + handlePermissionChange(); if(LEADTMR) clearInterval(LEADTMR); LEADTMR = false; @@ -739,6 +741,10 @@ Callbacks = { } user.data("rank", data.rank); + if (data.name === CLIENT.name) { + CLIENT.rank = data.rank; + handlePermissionChange(); + } formatUserlistItem(user); addUserDropdown(user); if(USEROPTS.sort_rank) @@ -761,6 +767,7 @@ Callbacks = { - setAFK - setLeader - setUserProfile + - setUserRank */ updateUser: function(data) { if(data.name == CLIENT.name) {