From: Alexander Moisseev Date: Sat, 14 Jul 2018 14:13:56 +0000 (+0300) Subject: [Minor] Do not shadow variables X-Git-Tag: 1.7.9~119^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b816237c36989477a5ead4c0de6b94eeaef57902;p=rspamd.git [Minor] Do not shadow variables --- 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"; } $("" + - "" + data.action + "" + - "" + data.score.toFixed(2) + "/" + data.required_score.toFixed(2) + "" + + "" + json.action + "" + + "" + json.score.toFixed(2) + "/" + json.required_score.toFixed(2) + "" + "") .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) {