diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-14 17:13:56 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-07-14 17:56:15 +0300 |
commit | b816237c36989477a5ead4c0de6b94eeaef57902 (patch) | |
tree | db8151254d3de68f5e4b79036f1ba506a199a6d9 | |
parent | 36ad4a3924ef58570eda1a19e03ec562298ed58a (diff) | |
download | rspamd-b816237c36989477a5ead4c0de6b94eeaef57902.tar.gz rspamd-b816237c36989477a5ead4c0de6b94eeaef57902.zip |
[Minor] Do not shadow variables
-rw-r--r-- | .eslintrc.json | 1 | ||||
-rw-r--r-- | interface/js/app/config.js | 4 | ||||
-rw-r--r-- | interface/js/app/rspamd.js | 20 | ||||
-rw-r--r-- | interface/js/app/upload.js | 25 |
4 files changed, 24 insertions, 26 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 9454f85d8..80303639e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -75,7 +75,6 @@ "no-loop-func": "off", "no-negated-condition": "off", "no-param-reassign": "off", - "no-shadow": "off", "no-underscore-dangle": "off", "no-use-before-define": "off", "one-var-declaration-per-line": "off", diff --git a/interface/js/app/config.js b/interface/js/app/config.js index 293fd7842..b3f99b9c0 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -49,8 +49,8 @@ define(["jquery"], xhr.setRequestHeader("Map", id); xhr.setRequestHeader("Debug", true); }, - error: function (data) { - save_map_error(rspamd, "local", null, null, data.statusText); + error: function (jqXHR) { + save_map_error(rspamd, "local", null, null, jqXHR.statusText); }, success: function () { save_map_success(rspamd); }, }); diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index a07d4ac03..708de27ae 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -159,10 +159,10 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, function displayUI() { // @toggle auth and main - var disconnect = $("#navBar .pull-right"); + var buttons = $("#navBar .pull-right"); $("#mainUI").show(); $("#progress").show(); - $(disconnect).show(); + $(buttons).show(); tabClick("#refresh"); $("#progress").hide(); } @@ -284,12 +284,12 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, beforeSend: function (xhr) { xhr.setRequestHeader("Password", password); }, - success: function (data) { + success: function (json) { $("#connectPassword").val(""); - if (data.auth === "failed") { + if (json.auth === "failed") { // Is actually never returned by Rspamd } else { - if (data.read_only) { + if (json.read_only) { ui.read_only = true; $("#learning_nav").hide(); $("#resetHistory").attr("disabled", true); @@ -307,8 +307,8 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, displayUI(); } }, - error: function (data) { - ui.alertMessage("alert-modal alert-error", data.statusText); + error: function (jqXHR) { + ui.alertMessage("alert-modal alert-error", jqXHR.statusText); $("#connectPassword").val(""); $("#connectPassword").focus(); } @@ -402,14 +402,14 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, } }, url: neighbours_status[ind].url + req_url, - success: function (data) { + success: function (json) { neighbours_status[ind].checked = true; - if (jQuery.isEmptyObject(data)) { + if (jQuery.isEmptyObject(json)) { neighbours_status[ind].status = false; // serv does not work } else { neighbours_status[ind].status = true; // serv does not work - neighbours_status[ind].data = data; + neighbours_status[ind].data = json; } if (neighbours_status.every(function (elt) { return elt.checked; })) { if (on_success) { diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js index fad074668..3fcfc3aad 100644 --- a/interface/js/app/upload.js +++ b/interface/js/app/upload.js @@ -56,9 +56,9 @@ define(["jquery"], xhr.setRequestHeader(name, value); }); }, - success: function (data) { + success: function (json) { cleanTextUpload(source); - if (data.success) { + if (json.success) { rspamd.alertMessage("alert-success", "Data successfully uploaded"); } }, @@ -89,38 +89,37 @@ define(["jquery"], beforeSend: function (xhr) { xhr.setRequestHeader("Password", rspamd.getPassword()); }, - success: function (input) { - var data = input; - if (data.action) { + success: function (json) { + if (json.action) { rspamd.alertMessage("alert-success", "Data successfully scanned"); var action = ""; - if (data.action === "clean" || "no action") { + if (json.action === "clean" || "no action") { action = "label-success"; } - else if (data.action === "rewrite subject" || "add header" || "probable spam") { + else if (json.action === "rewrite subject" || "add header" || "probable spam") { action = "label-warning"; } - else if (data.action === "spam") { + else if (json.action === "spam") { action = "label-danger"; } var score = ""; - if (data.score <= data.required_score) { + if (json.score <= json.required_score) { score = "label-success"; } - else if (data.score >= data.required_score) { + else if (json.score >= json.required_score) { score = "label-danger"; } $("<tbody id=\"tmpBody\"><tr>" + - "<td><span class=\"label " + action + "\">" + data.action + "</span></td>" + - "<td><span class=\"label " + score + "\">" + data.score.toFixed(2) + "/" + data.required_score.toFixed(2) + "</span></td>" + + "<td><span class=\"label " + action + "\">" + json.action + "</span></td>" + + "<td><span class=\"label " + score + "\">" + json.score.toFixed(2) + "/" + json.required_score.toFixed(2) + "</span></td>" + "</tr></tbody>") .insertAfter("#scanOutput thead"); var sym_desc = {}; var nsym = 0; - $.each(data.symbols, function (i, item) { + $.each(json.symbols, function (i, item) { if (typeof item === "object") { var sym_id = "sym_" + nsym; if (item.description) { |