From 9d78031f1d88dc28922952f33685b518c6282241 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sat, 14 Mar 2015 13:57:02 +0100 Subject: [PATCH] Give proper error message for too long annotations --- pgcommitfest/commitfest/static/commitfest/js/commitfest.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js index be143f9..ce0df91 100644 --- a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js +++ b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js @@ -143,12 +143,17 @@ function addAnnotation(threadid) { updateAnnotationMessages(threadid); $('#doAnnotateMessageButton').unbind('click'); $('#doAnnotateMessageButton').click(function() { + var msg = $('#annotateMessage').val(); + if (msg.length >= 500) { + alert('Maximum length for an annotation is 500 characters.\nYou should probably post an actual message in the thread!'); + return; + } $('#doAnnotateMessageButton').addClass('disabled'); $('#annotateMessageBody').addClass('loading'); $.post('/ajax/annotateMessage/', { 't': threadid, 'msgid': $.trim($('#annotateMsgId').val()), - 'msg': $('#annotateMessage').val() + 'msg': msg }).success(function(data) { if (data != 'OK') { alert(data); -- 2.39.5