fix: Keep completed downloads in cleanup operation

Updated the cleanup button to only remove cancelled, failed, and deleted downloads while preserving completed downloads for user records.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
root
2026-01-23 11:04:37 +00:00
parent 55bb85b56f
commit 8f9f544d47
+4 -4
View File
@@ -958,13 +958,13 @@
return groups; return groups;
} }
// Clear unwanted downloads (cancelled, deleted, failed) // Clear unwanted downloads (cancelled, failed, deleted - keeps completed, downloading, paused)
async function clearCompleted() { async function clearCompleted() {
// Find all unwanted downloads (not completed or downloading or paused) // Find all unwanted downloads (but keep completed, downloading, paused, pending)
const unwanted = allDownloads.filter(dl => const unwanted = allDownloads.filter(dl =>
dl.status === 'cancelled' || dl.status === 'cancelled' ||
dl.status === 'failed' || dl.status === 'failed' ||
dl.status === 'completed' // Also remove completed if desired dl.status === 'deleted' // If you have this status
); );
if (unwanted.length === 0) { if (unwanted.length === 0) {
@@ -981,7 +981,7 @@
let message = 'Supprimer '; let message = 'Supprimer ';
if (byStatus.cancelled) message += `${byStatus.cancelled} annulé(s) `; if (byStatus.cancelled) message += `${byStatus.cancelled} annulé(s) `;
if (byStatus.failed) message += `${byStatus.failed} échoué(s) `; if (byStatus.failed) message += `${byStatus.failed} échoué(s) `;
if (byStatus.completed) message += `${byStatus.completed} terminé(s) `; if (byStatus.deleted) message += `${byStatus.deleted} supprimé(s) `;
message += '?'; message += '?';
if (!confirm(message)) { if (!confirm(message)) {