From 31ceb54732672d8261a20efed016a6d92e3b5947 Mon Sep 17 00:00:00 2001 From: friedPotat0 <5374007+friedPotat0@users.noreply.github.com> Date: Sat, 12 Oct 2019 13:26:40 +0200 Subject: [PATCH 1/5] change text color of neutral rspamd symbol scores --- data/web/js/site/debug.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index c7e54433..2bbe8950 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -470,9 +470,12 @@ jQuery(function($){ } Object.keys(item.symbols).map(function(key) { var sym = item.symbols[key]; - if (sym.score <= 0) { + if (sym.score < 0) { sym.score_formatted = '(' + sym.score + ')' } + else if (sym.score === 0) { + sym.score_formatted = '(' + sym.score + ')' + } else { sym.score_formatted = '(' + sym.score + ')' } From c97b91503b02108717b73f8be47d861f1b8cc3aa Mon Sep 17 00:00:00 2001 From: friedPotat0 <5374007+friedPotat0@users.noreply.github.com> Date: Sat, 12 Oct 2019 13:27:21 +0200 Subject: [PATCH 2/5] change rspamd option delimiter --- data/web/js/site/debug.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index 2bbe8950..ace91757 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -481,7 +481,7 @@ jQuery(function($){ } var str = '' + key + ' ' + sym.score_formatted; if (sym.options) { - str += ' [' + sym.options.join(",") + "]"; + str += ' [' + sym.options.join(", ") + "]"; } item.symbols[key].str = str; }); From 84617b0d6b20aeef9f68cadd9b3ffbea3cd34c1d Mon Sep 17 00:00:00 2001 From: friedPotat0 <5374007+friedPotat0@users.noreply.github.com> Date: Sat, 12 Oct 2019 13:29:08 +0200 Subject: [PATCH 3/5] sort rspamd symbols in debug log --- data/web/js/site/debug.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index ace91757..d7b66a40 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -468,7 +468,17 @@ jQuery(function($){ else { item.rcpt = item.rcpt_smtp.join(", "); } - Object.keys(item.symbols).map(function(key) { + Object.keys(item.symbols).sort(function (a, b) { + if (item.symbols[a].score === 0) return 1 + if (item.symbols[b].score === 0) return -1 + if (item.symbols[b].score < 0 && item.symbols[a].score < 0) { + return item.symbols[a].score - item.symbols[b].score + } + if (item.symbols[b].score > 0 && item.symbols[a].score > 0) { + return item.symbols[b].score - item.symbols[a].score + } + return item.symbols[b].score - item.symbols[a].score + }).map(function(key) { var sym = item.symbols[key]; if (sym.score < 0) { sym.score_formatted = '(' + sym.score + ')' From 5f777a1b25c3aa45d9f613514c879d4c535190e3 Mon Sep 17 00:00:00 2001 From: friedPotat0 <5374007+friedPotat0@users.noreply.github.com> Date: Sat, 12 Oct 2019 13:30:29 +0200 Subject: [PATCH 4/5] remove obsolete lines --- data/web/js/site/debug.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index d7b66a40..f2ef0dcf 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -468,7 +468,7 @@ jQuery(function($){ else { item.rcpt = item.rcpt_smtp.join(", "); } - Object.keys(item.symbols).sort(function (a, b) { + item.symbols = Object.keys(item.symbols).sort(function (a, b) { if (item.symbols[a].score === 0) return 1 if (item.symbols[b].score === 0) return -1 if (item.symbols[b].score < 0 && item.symbols[a].score < 0) { @@ -493,17 +493,9 @@ jQuery(function($){ if (sym.options) { str += ' [' + sym.options.join(", ") + "]"; } - item.symbols[key].str = str; - }); + return str + }).join('
\n'); item.subject = escapeHtml(item.subject); - item.symbols = Object.keys(item.symbols). - map(function(key) { - return item.symbols[key]; - }).sort(function(e1, e2) { - return Math.abs(e1.score) < Math.abs(e2.score); - }).map(function(e) { - return e.str; - }).join("
\n"); var scan_time = item.time_real.toFixed(3) + ' / ' + item.time_virtual.toFixed(3); item.scan_time = { "options": { From d2d520336bfb0b658d460f5d071a0de11fd3bb98 Mon Sep 17 00:00:00 2001 From: friedPotat0 <5374007+friedPotat0@users.noreply.github.com> Date: Sat, 12 Oct 2019 13:31:10 +0200 Subject: [PATCH 5/5] change sorting of rspamd symbols in quarantine --- data/web/js/site/quarantine.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/web/js/site/quarantine.js b/data/web/js/site/quarantine.js index b1c0bc83..6364b579 100644 --- a/data/web/js/site/quarantine.js +++ b/data/web/js/site/quarantine.js @@ -98,6 +98,12 @@ jQuery(function($){ data.symbols.sort(function (a, b) { if (a.score === 0) return 1 if (b.score === 0) return -1 + if (b.score < 0 && a.score < 0) { + return a.score - b.score + } + if (b.score > 0 && a.score > 0) { + return b.score - a.score + } return b.score - a.score }) $.each(data.symbols, function (index, value) {