Change skipratio fallback to error response

This commit is contained in:
zeratul0 2017-03-16 18:35:42 -04:00 committed by GitHub
parent d93e42a71c
commit ab1358df36
1 changed files with 10 additions and 3 deletions

View File

@ -114,10 +114,17 @@ OptionsModule.prototype.handleSetOptions = function (user, data) {
if ("voteskip_ratio" in data) { if ("voteskip_ratio" in data) {
var ratio = parseFloat(data.voteskip_ratio); var ratio = parseFloat(data.voteskip_ratio);
if (isNaN(ratio) || ratio < 0) { if (isNaN(ratio) || ratio < 0) {
ratio = 0.5; user.socket.emit("validationError", {
target: "#cs-voteskip_ratio",
message: "Input must be a number 0 or greater. 1.0 is 100%."
});
} else {
this.opts.voteskip_ratio = ratio;
sendUpdate = true;
user.socket.emit("validationPassed", {
target: "#cs-voteskip_ratio"
});
} }
this.opts.voteskip_ratio = ratio;
sendUpdate = true;
} }
if ("afk_timeout" in data) { if ("afk_timeout" in data) {