Skip to content

Commit

Permalink
Replace "undefined" with "∅" for better clarity
Browse files Browse the repository at this point in the history
- Changed "undefined" to empty set symbol (∅) for parsing results in the score header
- Display empty set symbol (∅) in notifications when no symbols are found
  • Loading branch information
moisseev committed Sep 6, 2024
1 parent a19afd4 commit 472b62f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/libHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -110,6 +110,6 @@ libHeader.parseHeaders = function (symbols) {
}
parsed.fuzzy = (parsed.fuzzy)
? Number(parseFloat(parsed.fuzzy).toFixed(10))
: "undefined";
: "";
return {fuzzySymbolsCount, parsed};
};

0 comments on commit 472b62f

Please sign in to comment.