Include video ID in the progress bar to prevent false clears

This commit is contained in:
calzoneman 2016-05-19 21:31:10 -07:00
parent 8ed50d0b08
commit 75245e4d98
4 changed files with 31 additions and 16 deletions

View File

@ -361,25 +361,29 @@ PlaylistModule.prototype.handleQueue = function (user, data) {
if (data.type === "yp" && !perms.canAddList(user)) {
user.socket.emit("queueFail", {
msg: "You don't have permission to add playlists",
link: link
link: link,
id: id
});
return;
} else if (util.isLive(type) && !perms.canAddLive(user)) {
user.socket.emit("queueFail", {
msg: "You don't have permission to add live media",
link: link
link: link,
id: id
});
return;
} else if (type === "cu" && !perms.canAddCustom(user)) {
user.socket.emit("queueFail", {
msg: "You don't have permission to add custom embeds",
link: link
link: link,
id: id
});
return;
} else if (type === "fi" && !perms.canAddRawFile(user)) {
user.socket.emit("queueFail", {
msg: "You don't have permission to add raw video files",
link: link
link: link,
id: id
});
return;
}
@ -412,7 +416,8 @@ PlaylistModule.prototype.handleQueue = function (user, data) {
if (user.queueLimiter.throttle(limit)) {
user.socket.emit("queueFail", {
msg: "You are adding videos too quickly",
link: link
link: link,
id: id
});
return;
}
@ -448,7 +453,8 @@ PlaylistModule.prototype.queueStandard = function (user, data) {
var error = function (what) {
user.socket.emit("queueFail", {
msg: what,
link: data.link
link: data.link,
id: data.id
});
};
@ -501,7 +507,8 @@ PlaylistModule.prototype.queueYouTubePlaylist = function (user, data) {
var error = function (what) {
user.socket.emit("queueFail", {
msg: what,
link: data.link
link: data.link,
id: data.id
});
};
@ -865,7 +872,8 @@ PlaylistModule.prototype._addItem = function (media, data, user, cb) {
var qfail = function (msg) {
user.socket.emit("queueFail", {
msg: msg,
link: data.link
link: data.link,
id: data.id
});
if (cb) {
cb();

View File

@ -25,7 +25,7 @@ Callbacks = {
.text("Connected")
.appendTo($("#messagebuffer"));
scrollChat();
stopQueueSpinner();
stopQueueSpinner(null);
},
disconnect: function() {
@ -724,7 +724,7 @@ Callbacks = {
queue: function(data) {
PL_ACTION_QUEUE.queue(function (plq) {
stopQueueSpinner();
stopQueueSpinner(data.item.media.id);
var li = makeQueueEntry(data.item, true);
if (data.item.uid === PL_CURRENT)
li.addClass("queue_active");
@ -762,7 +762,9 @@ Callbacks = {
},
queueFail: function (data) {
stopQueueSpinner();
if (data.id) {
stopQueueSpinner(id);
}
queueMessage(data, "alert-danger");
},

View File

@ -420,7 +420,7 @@ function queue(pos, src) {
delete data.link;
socket.emit("queue", data);
startQueueSpinner();
startQueueSpinner(data.id);
if (emitQueue.length > 0) {
notification.textContent = "Waiting to queue " + emitQueue[0].link;
} else {

View File

@ -3041,12 +3041,13 @@ function showChannelSettings() {
// There is a point where this file needed to stop and we have clearly passed
// it but let's keep going and see what happens
function startQueueSpinner() {
function startQueueSpinner(id) {
if ($("#queueprogress").length > 0) {
return;
}
var progress = $("<div/>").addClass("progress").attr("id", "queueprogress");
var progress = $("<div/>").addClass("progress").attr("id", "queueprogress")
.data("queue-id", id);
var progressBar = $("<div/>").addClass("progress-bar progress-bar-striped active")
.attr({
role: "progressbar",
@ -3059,6 +3060,10 @@ function startQueueSpinner() {
progress.appendTo($("#addfromurl"));
}
function stopQueueSpinner() {
$("#queueprogress").remove();
function stopQueueSpinner(id) {
if (id && $("#queueprogress").data("queue-id") === id) {
$("#queueprogress").remove();
} else if (id === null) {
$("#queueprogress").remove();
}
}