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] 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 + ')'