mirror of https://github.com/calzoneman/sync.git
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
|
||||
&& this.leader != user
|
||||
&& user.noflood("queue", 1.5)) {
|
||||
&& user.noflood("queue", 3)) {
|
||||
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.temp = !this.hasPermission(user, "addnontemp");
|
||||
|
||||
|
|
|
@ -450,6 +450,15 @@ Playlist.prototype.clear = function() {
|
|||
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) {
|
||||
this.leading = lead;
|
||||
var pl = this;
|
||||
|
|
|
@ -161,4 +161,13 @@ ULList.prototype.toArray = function(pack) {
|
|||
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;
|
||||
|
|
|
@ -757,7 +757,7 @@ Callbacks = {
|
|||
}
|
||||
makeAlert("Error", data, "alert-error")
|
||||
.addClass("span12")
|
||||
.insertAfter($("#mediaurl").parent());
|
||||
.insertBefore($("#extended_controls"));
|
||||
},
|
||||
|
||||
setTemp: function(data) {
|
||||
|
|
Loading…
Reference in New Issue