From afa1f8a2ab541d95de7ca2ae19d4f88b1a36e627 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Mon, 25 Nov 2019 16:38:03 +0100 Subject: [PATCH] Ensure warning status timeouts are honored When showing a new status popup we want to set a timer for how long to show it. In cases where we show many statuses in a fast succession we need to remove any running timeouts when showing a new one. There are exceptions when new statuses won't be shown, and thats if a more severe status is already showing, i.e and error or a warning. Warnings can still have timeouts. There was a bug that occured when we tried to show a normal status while a warning was showing. The bug caused the warning status timeout to be removed even if the normal status was never shown. We should only remove running timeouts if we're actually going to show a new status. --- app/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ui.js b/app/ui.js index 48e4d13..0eca9a4 100644 --- a/app/ui.js +++ b/app/ui.js @@ -447,8 +447,6 @@ const UI = { showStatus(text, status_type, time) { const statusElem = document.getElementById('noVNC_status'); - clearTimeout(UI.statusTimeout); - if (typeof status_type === 'undefined') { status_type = 'normal'; } @@ -470,6 +468,8 @@ const UI = { return; } + clearTimeout(UI.statusTimeout); + switch (status_type) { case 'error': statusElem.classList.remove("noVNC_status_warn"); -- 2.39.2