Browse Source

[Minor] Do not shadow variables

tags/1.7.9
Alexander Moisseev 5 years ago
parent
commit
b816237c36
4 changed files with 24 additions and 26 deletions
  1. 0
    1
      .eslintrc.json
  2. 2
    2
      interface/js/app/config.js
  3. 10
    10
      interface/js/app/rspamd.js
  4. 12
    13
      interface/js/app/upload.js

+ 0
- 1
.eslintrc.json View 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",

+ 2
- 2
interface/js/app/config.js View 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); },
});

+ 10
- 10
interface/js/app/rspamd.js View 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) {

+ 12
- 13
interface/js/app/upload.js View 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) {

Loading…
Cancel
Save