Handle posting errors a little more elegantly.
authorArt Cancro <ajc@citadel.org>
Wed, 24 Nov 2021 01:09:23 +0000 (20:09 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 24 Nov 2021 01:09:23 +0000 (20:09 -0500)
webcit-ng/messages.c
webcit-ng/static/js/view_forum.js

index b33cdf0..a910b1f 100644 (file)
@@ -136,7 +136,7 @@ void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *eu
        char response_string[1024];
 
        if ((h->request_body == NULL) || (h->request_body_length < 1)) {
-               do_404(h);      // Refuse to post a null message
+               do_404(h);                      // Refuse to post a null message
                return;
        }
 
index 0e8f36c..edf0a97 100644 (file)
@@ -237,13 +237,8 @@ function open_reply_box(prefix, msgnum, is_quoted) {
        + _("Cancel")
        + "</a></span>"
 
-       + "</span>";                                                    // end buttons on right side
-       if (msg.subj) {
-               replybox +=
-               "<br><span class=\"ctdl-msgsubject\">" + "FIXME subject" + "</span>";
-       }
-       replybox +=
-         "</div><br>"                                                  // end footer
+       + "</span>"                                                     // end buttons on right side
+       + "</div><br>"                                                  // end footer
 
 
        + "</div>"                                                      // end content
@@ -285,7 +280,11 @@ function save_message(div_name, reply_to_msgnum) {
                                document.getElementById(div_name).outerHTML = "";               // close the editor
                        }
                        else {
-                               alert(_("An error has occurred."));     // inelegant but hopefully infrequent
+                               error_message = request.responseText;
+                               if (error_message.length == 0) {
+                                       error_message = _("An error has occurred.");
+                               }
+                               alert(error_message);                                           // FIXME make this pretty
                        }
                }
        };