From 5268eba101e1919e2ced0385c51c58b14b8ed668 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 12 Nov 2020 12:09:51 -0500 Subject: Notify server when user discards attachment --- themes/alps/assets/attachments.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'themes') diff --git a/themes/alps/assets/attachments.js b/themes/alps/assets/attachments.js index 612808a..dc6cc04 100644 --- a/themes/alps/assets/attachments.js +++ b/themes/alps/assets/attachments.js @@ -80,6 +80,12 @@ function attachFile(file) { attachments = attachments.filter(a => a !== attachment); node.remove(); updateState(); + + if (typeof attachment.uuid !== "undefined") { + const cancel = new XMLHttpRequest(); + cancel.open("POST", `/compose/attachment/${attachment.uuid}/remove`); + cancel.send(); + } }); let formData = new FormData(); -- cgit v1.2.3