From: Art Cancro Date: Tue, 21 Nov 2023 00:00:13 +0000 (-0500) Subject: upload.js: when removing an attachment, delete the div X-Git-Tag: v997~92 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=971823f82e72a06e6096606d2063f0836886ffbb upload.js: when removing an attachment, delete the div This is handled the usual way, when we get a successful response from the HTTP DELETE method, it triggers the removal of the list element showing the attachment. --- diff --git a/webcit-ng/static/js/upload.js b/webcit-ng/static/js/upload.js index 554121372..5ae027c8f 100644 --- a/webcit-ng/static/js/upload.js +++ b/webcit-ng/static/js/upload.js @@ -82,7 +82,9 @@ delete_upload = async(ref) => { ); if (response.ok) { // If the server accepted the delete, remove it from the screen - // FIXME do the delete + console.log("server deleted " + ref); + var el = document.getElementById(ref); + el.parentNode.removeChild(el); } } @@ -106,7 +108,7 @@ function upload_file(file) { // Add these uploads to the displayed list j_response.forEach((item) => { let new_upl = document.createElement("li"); - // item["ref"] is what we need + new_upl.setAttribute("id", item["ref"]); // set the element id to the upload reference new_upl.innerHTML = `` + ` ` + item["uploadfilename"] + " (" + item["contenttype"] + ", " + item["contentlength"] + " " + _("bytes") + ")"; diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 0efdf37f6..d058f470e 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -372,9 +372,9 @@ function refresh_mail_display() { fetch_stat = async() => { response = await fetch(url); stat = await(response.json()); - if (stat.room_mtime > room_mtime) { // FIXME commented out to force refreshes + if (stat.room_mtime > room_mtime) { // if modified... room_mtime = stat.room_mtime; - render_mailbox_display(newmail_notify.YES); + render_mailbox_display(newmail_notify.YES); // ...force a refresh } } fetch_stat();