Disallow non-moderators from adding a video that exists 10 times already
This commit is contained in:
parent
77a2d9b0e2
commit
f910f437bb
|
@ -1155,10 +1155,15 @@ Channel.prototype.tryQueue = function(user, data) {
|
||||||
|
|
||||||
if(user.rank < Rank.Moderator
|
if(user.rank < Rank.Moderator
|
||||||
&& this.leader != user
|
&& this.leader != user
|
||||||
&& user.noflood("queue", 1.5)) {
|
&& user.noflood("queue", 3)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(user.rank < Rank.Moderator && this.playlist.count(data.id) > 10) {
|
||||||
|
user.socket.emit("queueFail", "That video is already on the " +
|
||||||
|
"playlist 10 times.");
|
||||||
|
}
|
||||||
|
|
||||||
data.queueby = user ? user.name : "";
|
data.queueby = user ? user.name : "";
|
||||||
data.temp = !this.hasPermission(user, "addnontemp");
|
data.temp = !this.hasPermission(user, "addnontemp");
|
||||||
|
|
||||||
|
|
|
@ -450,6 +450,15 @@ Playlist.prototype.clear = function() {
|
||||||
clearInterval(this._leadInterval);
|
clearInterval(this._leadInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Playlist.prototype.count = function (id) {
|
||||||
|
var count = 0;
|
||||||
|
this.items.forEach(function (i) {
|
||||||
|
if(i.media.id === id)
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
Playlist.prototype.lead = function(lead) {
|
Playlist.prototype.lead = function(lead) {
|
||||||
this.leading = lead;
|
this.leading = lead;
|
||||||
var pl = this;
|
var pl = this;
|
||||||
|
|
|
@ -161,4 +161,13 @@ ULList.prototype.toArray = function(pack) {
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* iterate across the playlist */
|
||||||
|
ULList.prototype.forEach = function (fn) {
|
||||||
|
var item = this.first;
|
||||||
|
while(item !== null) {
|
||||||
|
fn(item);
|
||||||
|
item = item.next;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.ULList = ULList;
|
exports.ULList = ULList;
|
||||||
|
|
|
@ -757,7 +757,7 @@ Callbacks = {
|
||||||
}
|
}
|
||||||
makeAlert("Error", data, "alert-error")
|
makeAlert("Error", data, "alert-error")
|
||||||
.addClass("span12")
|
.addClass("span12")
|
||||||
.insertAfter($("#mediaurl").parent());
|
.insertBefore($("#extended_controls"));
|
||||||
},
|
},
|
||||||
|
|
||||||
setTemp: function(data) {
|
setTemp: function(data) {
|
||||||
|
|
Loading…
Reference in a new issue