#876: show the real Quarantine tab count on open (not a stale 0)
The Quarantine tab badge was only populated by loadQuarantineList(), which runs when the tab is clicked — so opening Library History showed a stale 0 until then. Refresh the count on modal open via the existing /api/quarantine/list endpoint.
This commit is contained in:
parent
e7814e0acf
commit
93af95d865
1 changed files with 14 additions and 0 deletions
|
|
@ -3253,9 +3253,23 @@ function openLibraryHistoryModal() {
|
||||||
overlay.classList.remove('hidden');
|
overlay.classList.remove('hidden');
|
||||||
_libraryHistoryState.page = 1;
|
_libraryHistoryState.page = 1;
|
||||||
loadLibraryHistory();
|
loadLibraryHistory();
|
||||||
|
_refreshQuarantineTabCount(); // #876: count correct on open, not only after clicking the tab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #876: keep the Quarantine tab badge accurate the moment the modal opens. The
|
||||||
|
// full count was previously only set by loadQuarantineList() (i.e. after the tab
|
||||||
|
// was clicked), so it showed a stale 0 until then.
|
||||||
|
async function _refreshQuarantineTabCount() {
|
||||||
|
const el = document.getElementById('history-quarantine-count');
|
||||||
|
if (!el) return;
|
||||||
|
try {
|
||||||
|
const resp = await fetch('/api/quarantine/list');
|
||||||
|
const data = await resp.json();
|
||||||
|
el.textContent = (data.entries || []).length;
|
||||||
|
} catch (e) { /* leave the existing value on error */ }
|
||||||
|
}
|
||||||
|
|
||||||
// ──────────────────────────────────────────────────────────────────────
|
// ──────────────────────────────────────────────────────────────────────
|
||||||
// Quarantine tab — rendered inside the Library History modal as a third
|
// Quarantine tab — rendered inside the Library History modal as a third
|
||||||
// tab next to Downloads + Server Imports. Reuses the existing list +
|
// tab next to Downloads + Server Imports. Reuses the existing list +
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue