]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Do not shadow variables
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 14 Jul 2018 14:13:56 +0000 (17:13 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 14 Jul 2018 14:56:15 +0000 (17:56 +0300)
.eslintrc.json
interface/js/app/config.js
interface/js/app/rspamd.js
interface/js/app/upload.js

index 9454f85d86e36d576e504f0292138108f487e13b..80303639e97ac186e83de6b51b6399fbc0033896 100644 (file)
@@ -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",
index 293fd78429cdb40291dc56bb48ab8e7a53e4d2e5..b3f99b9c015ee5f880ba1be2b149971af90582a1 100644 (file)
@@ -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); },
             });
index a07d4ac03550a025a2f96dfe24434fd5f7b1ec16..708de27ae54267cfd9b38e81cccf6c7b76eff001 100644 (file)
@@ -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) {
index fad074668e24deed3387f6b200106c144cf1e785..3fcfc3aaddb7d68bac3326d7620cf9799961ddc9 100644 (file)
@@ -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) {