Update the correct file this time

This commit is contained in:
Simon Walton 2018-07-10 18:25:43 -07:00
parent 41b08fcf40
commit 7455f9fc18

View file

@ -58,7 +58,11 @@ $(document).ready(function(){
} }
Settings.handlePostSettings = function(formJSON) { Settings.handlePostSettings = function(formJSON) {
if (!checkAvatarHeights()) {
return false;
}
// check if we've set the basic http password // check if we've set the basic http password
if (formJSON["security"]) { if (formJSON["security"]) {
@ -1093,15 +1097,35 @@ $(document).ready(function(){
} }
function checkAvatarHeights() { function checkAvatarHeights() {
var minHeight = Settings.avatars.min_avatar_height; var errorString = '';
var maxHeight = Settings.avatars.max_avatar_height; var minAllowedHeight = 0.009;
if (maxHeight < minHeight) { var maxAllowedHeight = 1755;
swal({ var currentForm = form2js('settings-form');
type: 'error', var minHeight = currentForm.avatars.min_avatar_height;
title: '', var maxHeight = currentForm.avatars.max_avatar_height;
text: "Maximum avatar height must not be less than minimum avatar height", //var minHeight = Number($('input[name="avatars.min_avatar_height"]').attr('value'));
html: true //var maxHeight = Number($('input[name="avatars.max_avatar_height"]').attr('value'));
}, function(){swal.close();});
} if (maxHeight < minHeight) {
errorString = 'Maximum avatar height must not be less than minimum avatar height<br>';
};
if (minHeight < minAllowedHeight) {
errorString += 'Minimum avatar height must not be less than ' + minAllowedHeight + '<br>';
}
if (maxHeight > maxAllowedHeight) {
errorString += 'Maximum avatar height must not be greater than ' + maxAllowedHeight + '<br>';
}
if (errorString.length > 0) {
swal({
type: 'error',
title: '',
text: errorString,
html: true
});
return false;
} else {
return true;
}
} }
}); });