Fix Leader bug and Rank bug

This commit is contained in:
calzoneman 2013-02-16 16:33:38 -06:00
parent 728f23a05b
commit ad705e8779
2 changed files with 10 additions and 3 deletions

View File

@ -353,8 +353,10 @@ Channel.prototype.playNext = function() {
// Synchronize to a sync packet from the leader // Synchronize to a sync packet from the leader
Channel.prototype.update = function(data) { Channel.prototype.update = function(data) {
if(this.currentMedia == null) if(this.currentMedia == null) {
this.currentMedia = data; this.currentMedia = new Media(data.id, data.title, data.seconds, data.type);
this.currentMedia.currentTIme = data.currentTime;
}
else else
this.currentMedia.currentTime = data.seconds; this.currentMedia.currentTime = data.seconds;
this.sendAll('mediaUpdate', this.currentMedia.packupdate()); this.sendAll('mediaUpdate', this.currentMedia.packupdate());
@ -469,8 +471,9 @@ Channel.prototype.demoteUser = function(actor, name) {
// but you never know // but you never know
Channel.prototype.changeLeader = function(name) { Channel.prototype.changeLeader = function(name) {
if(this.leader != null) { if(this.leader != null) {
var old = leader;
this.leader = null; this.leader = null;
this.broadcastRankUpdate(this.leader); this.broadcastRankUpdate(old);
} }
if(name == "") { if(name == "") {
return; return;

View File

@ -165,6 +165,10 @@ function initCallbacks() {
else { else {
sendVideoUpdate = function() { } sendVideoUpdate = function() { }
} }
RANK = data.rank;
if(data.rank >= Rank.Moderator)
$('#playlist_controls').css("display", "block");
} }
var users = $('#userlist').children(); var users = $('#userlist').children();
for(var i = 0; i < users.length; i++) { for(var i = 0; i < users.length; i++) {