From 472b62f6482cca053de8862289fef963dfac5d6a Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Fri, 6 Sep 2024 13:56:34 +0300 Subject: [PATCH] =?UTF-8?q?Replace=20"undefined"=20with=20"=E2=88=85"=20fo?= =?UTF-8?q?r=20better=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed "undefined" to empty set symbol (∅) for parsing results in the score header - Display empty set symbol (∅) in notifications when no symbols are found --- manifest.json | 2 +- scripts/background.js | 2 +- scripts/libHeader.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 357dd8b..d6e7a9a 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", "default_locale": "en", - "version": "2.4.0", + "version": "2.4.1", "author": "Alexander Moisseev (moiseev@mezonplus.ru)", "homepage_url": "https://github.com/moisseev/rspamd-spamness", "icons": { diff --git a/scripts/background.js b/scripts/background.js index 8574eb2..e721edb 100644 --- a/scripts/background.js +++ b/scripts/background.js @@ -76,7 +76,7 @@ async function sendMessageToRspamd(message, buttonId, windowId, tabIndex, action ? `${s.score.toFixed(2)} [${s.score < 0 ? "-" : ""}${s.options[0]}]` : `${s.name} (${s.score.toFixed(2)}) [${s.options[0]}]`; }) - .join("; "); + .join("; ") || "∅"; } async function handleResponse(response) { diff --git a/scripts/libHeader.js b/scripts/libHeader.js index d7b3aa0..1b1cb44 100644 --- a/scripts/libHeader.js +++ b/scripts/libHeader.js @@ -96,7 +96,7 @@ libHeader.parseHeaders = function (symbols) { const parsed = []; const b = symbols.match(/BAYES_(?:HAM|SPAM)\((([-])?[\d.]+)\)(?:\[([^\]]+?)%\])?/); - parsed.bayes = (b) ? b[1] : "undefined"; + parsed.bayes = (b) ? b[1] : "∅"; parsed.bayesOptions = (b && b[3]) ? (b[2] || "") + b[3] : ""; const re = /FUZZY_(?:WHITE|PROB|DENIED|UNKNOWN)\(([-\d.]+)\)/g; @@ -110,6 +110,6 @@ libHeader.parseHeaders = function (symbols) { } parsed.fuzzy = (parsed.fuzzy) ? Number(parseFloat(parsed.fuzzy).toFixed(10)) - : "undefined"; + : "∅"; return {fuzzySymbolsCount, parsed}; };