From 2b5107a5be4fb8234014c71187336190237ba19c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 23 Nov 2021 20:09:23 -0500 Subject: [PATCH] Handle posting errors a little more elegantly. --- webcit-ng/messages.c | 2 +- webcit-ng/static/js/view_forum.js | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/webcit-ng/messages.c b/webcit-ng/messages.c index b33cdf0c3..a910b1f6a 100644 --- a/webcit-ng/messages.c +++ b/webcit-ng/messages.c @@ -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; } diff --git a/webcit-ng/static/js/view_forum.js b/webcit-ng/static/js/view_forum.js index 0e8f36c22..edf0a971b 100644 --- a/webcit-ng/static/js/view_forum.js +++ b/webcit-ng/static/js/view_forum.js @@ -237,13 +237,8 @@ function open_reply_box(prefix, msgnum, is_quoted) { + _("Cancel") + "" - + ""; // end buttons on right side - if (msg.subj) { - replybox += - "
" + "FIXME subject" + ""; - } - replybox += - "
" // end footer + + "" // end buttons on right side + + "
" // end footer + "" // 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 } } }; -- 2.39.2