Fix issue with queue progress

If the user queues a PeerTube link with a long uuid the progress bar would never go away. Now it will just check against the hostname.
This commit is contained in:
Xaekai 2022-01-24 05:58:32 -08:00 committed by Calvin Montgomery
parent 8774dc89e7
commit ffd01fe30b
1 changed files with 11 additions and 6 deletions

View File

@ -3216,6 +3216,9 @@ function startQueueSpinner(data) {
if (data.type === "yp") { if (data.type === "yp") {
id = "$any"; id = "$any";
} }
if (data.type === "pt") {
id = data.id.split(';').shift()
}
var progress = $("<div/>").addClass("progress").attr("id", "queueprogress") var progress = $("<div/>").addClass("progress").attr("id", "queueprogress")
.data("queue-id", id); .data("queue-id", id);
@ -3232,12 +3235,14 @@ function startQueueSpinner(data) {
} }
function stopQueueSpinner(data) { function stopQueueSpinner(data) {
var shouldRemove = (data !== null && const qid = $("#queueprogress").data("queue-id");
typeof data === 'object' && switch (true){
$("#queueprogress").data("queue-id") === data.id); case data === null:
shouldRemove = shouldRemove || data === null; case qid === "$any":
shouldRemove = shouldRemove || $("#queueprogress").data("queue-id") === "$any"; case qid === data?.id:
if (shouldRemove) { return $("#queueprogress").remove();
}
if (data?.type === "pt" && new RegExp(qid).test(data?.id)) {
$("#queueprogress").remove(); $("#queueprogress").remove();
} }
} }