From ffd01fe30b451cbe508a9404f25576f092285605 Mon Sep 17 00:00:00 2001 From: Xaekai Date: Mon, 24 Jan 2022 05:58:32 -0800 Subject: [PATCH] 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. --- www/js/util.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/www/js/util.js b/www/js/util.js index 8c48bc97..e148fa9a 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -3216,6 +3216,9 @@ function startQueueSpinner(data) { if (data.type === "yp") { id = "$any"; } + if (data.type === "pt") { + id = data.id.split(';').shift() + } var progress = $("
").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(); } }