From: Art Cancro Date: Sun, 19 Nov 2023 18:39:12 +0000 (-0500) Subject: When a mail compose is canceled, flush all uploads. X-Git-Tag: v997~93 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=c0342d49133f1fff5057077e513cdf02f3123746 When a mail compose is canceled, flush all uploads. Most of this was already in place. We now just run through our upload list and do an async DELETE operation for each one. --- diff --git a/webcit-ng/static/js/upload.js b/webcit-ng/static/js/upload.js index ac72bbee8..554121372 100644 --- a/webcit-ng/static/js/upload.js +++ b/webcit-ng/static/js/upload.js @@ -165,6 +165,15 @@ function show_or_hide_upload_window() { } +// Helper function for flush_uploads() +flush_one_upload = async(ref) => { + response = await fetch( + "/ctdl/p/" + ref, { method: "DELETE" } + ); + // We don't have any interest in the server response. +} + + // Flush all uploaded files and close the window function flush_uploads() { upload_window = document.getElementById('ctdl-upload'); @@ -173,9 +182,9 @@ function flush_uploads() { upload_window.style.display='none'; } - // FIXME tell the server to delete the files + // tell the server to delete the files uploads.forEach(u => { - console.log(u.ref); + flush_one_upload(u.ref); }); uploads=[];