]> code.citadel.org Git - citadel.git/commitdiff
Capture the new message number from the etag of the post transaction
authorArt Cancro <ajc@citadel.org>
Fri, 26 Nov 2021 05:51:12 +0000 (00:51 -0500)
committerArt Cancro <ajc@citadel.org>
Fri, 26 Nov 2021 05:51:12 +0000 (00:51 -0500)
webcit-ng/static/js/view_forum.js

index aacb8831af967988864288807cc681db37f38c64..8d13b1080bdefab9b2de2032b6bb088f65d221fd 100644 (file)
@@ -333,7 +333,13 @@ function forum_save_message(div_name, reply_to_msgnum) {
                if (request.readyState == 4) {
                        document.body.style.cursor = "default";
                        if (Math.trunc(request.status / 100) == 2) {
-                               alert("headers: " + request.getAllResponseHeaders());
+                               headers = request.getAllResponseHeaders().split("\n");
+                               for (var i in headers) {
+                                       if (headers[i].startsWith("etag: ")) {
+                                               new_msg_num = headers[i].split(" ")[1];
+                                               alert(new_msg_num);
+                                       }
+                               }
                                document.getElementById(div_name).outerHTML = "";               // close the editor
                        }
                        else {