handle users typing subjects in all caps (#30454)
This commit is contained in:
parent
68162dc7be
commit
f16cafc034
|
@ -107,6 +107,19 @@ function alter_new_issue_page() {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
$('input#issue_subject').on('change', function(evt) {
|
||||
var val = $(this).val();
|
||||
var uppercases = val.match(/[A-Z]/g).length;
|
||||
var all_letters = val.match(/[^\s+]/g).length;
|
||||
var ratio = uppercases / all_letters;
|
||||
if (ratio > 0.6) { // more than 60% of uppercase letters
|
||||
// change to lower case
|
||||
$(this).val(val.toLowerCase());
|
||||
// and disable high priority values
|
||||
$('#issue_priority_id option + option + option').attr('disabled', true);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
|
Loading…
Reference in New Issue