Rearrange ranks a bit and fix unleader bug

This commit is contained in:
calzoneman 2013-03-05 17:06:25 -06:00
parent b2b134ce4a
commit 91b8a6cab6
5 changed files with 16 additions and 10 deletions

View file

@ -477,7 +477,8 @@ Channel.prototype.changeLeader = function(name) {
this.broadcastRankUpdate(old); this.broadcastRankUpdate(old);
} }
if(name == "") { if(name == "") {
channelVideoUpdate(this, this.currentMedia.id); if(this.currentMedia != null)
channelVideoUpdate(this, this.currentMedia.id);
return; return;
} }
for(var i = 0; i < this.users.length; i++) { for(var i = 0; i < this.users.length; i++) {

View file

@ -8,14 +8,15 @@
exports.Guest = 0; exports.Guest = 0;
exports.Member = 1; exports.Member = 1;
exports.Moderator = 4; exports.Moderator = 2;
exports.Owner = 8; exports.Owner = 3;
exports.Siteadmin = 255; exports.Siteadmin = 255;
var permissions = { var permissions = {
queue: exports.Moderator, queue: exports.Moderator,
assignLeader: exports.Moderator, assignLeader: exports.Moderator,
kick: exports.Moderator, kick: exports.Moderator,
promote: exports.Moderator,
search: exports.Guest, search: exports.Guest,
chat: exports.Guest, chat: exports.Guest,
}; };

12
user.js
View file

@ -63,14 +63,18 @@ User.prototype.initCallbacks = function() {
}.bind(this)); }.bind(this));
this.socket.on('promote', function(data) { this.socket.on('promote', function(data) {
if(this.channel != null) { if(Rank.hasPermission(this, "promote")) {
this.channel.promoteUser(this, data.name); if(this.channel != null) {
this.channel.promoteUser(this, data.name);
}
} }
}.bind(this)); }.bind(this));
this.socket.on('demote', function(data) { this.socket.on('demote', function(data) {
if(this.channel != null) { if(Rank.hasPermission(this, "promote")) {
this.channel.demoteUser(this, data.name); if(this.channel != null) {
this.channel.demoteUser(this, data.name);
}
} }
}.bind(this)); }.bind(this));

View file

@ -150,7 +150,7 @@ function initCallbacks() {
PLAYER.api('getCurrentTime', function(data) { PLAYER.api('getCurrentTime', function(data) {
socket.emit('mediaUpdate', { socket.emit('mediaUpdate', {
id: PLAYER.videoid, id: PLAYER.videoid,
seconds: data.seconds, seconds: data,
paused: false, paused: false,
type: "vi" type: "vi"
}); });

View file

@ -19,8 +19,8 @@ var pw = readCookie('sync_pw');
var Rank = { var Rank = {
Guest: 0, Guest: 0,
Member: 1, Member: 1,
Moderator: 4, Moderator: 2,
Owner: 8, Owner: 3,
Siteadmin: 255 Siteadmin: 255
}; };