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