When a mail compose is canceled, flush all uploads.
authorArt Cancro <ajc@citadel.org>
Sun, 19 Nov 2023 18:39:12 +0000 (13:39 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 19 Nov 2023 18:39:12 +0000 (13:39 -0500)
Most of this was already in place.  We now just run through our upload
list and do an async DELETE operation for each one.

webcit-ng/static/js/upload.js

index ac72bbee8e8afc96f0ead6e61d499e767bd1201f..5541213724bc4044b88cd177202a4c6e652eb21b 100644 (file)
@@ -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=[];