summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2015-03-14 12:57:02 +0000
committerMagnus Hagander2015-03-14 12:57:02 +0000
commit9d78031f1d88dc28922952f33685b518c6282241 (patch)
treef11aab37925b635a3764ad30f14bee25a38406cf
parent9ae46a51835aab69cf9a6ca153b5b9ec6673f64b (diff)
Give proper error message for too long annotations
-rw-r--r--pgcommitfest/commitfest/static/commitfest/js/commitfest.js7
1 files changed, 6 insertions, 1 deletions
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);