aboutsummaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorLibravatar Raphael Jenni <RaphaelJenni@users.noreply.github.com>2023-01-02 12:10:44 +0100
committerLibravatar GitHub <noreply@github.com>2023-01-02 11:10:44 +0000
commit042838ec4263950c62f5c1c978dbcd0d529719a1 (patch)
treec68d9bca7ea89659cffefa014a89b27e8b564a89 /recipes
parentUse unread rooms count like Element app does (diff)
downloadferdium-recipes-042838ec4263950c62f5c1c978dbcd0d529719a1.tar.gz
ferdium-recipes-042838ec4263950c62f5c1c978dbcd0d529719a1.tar.zst
ferdium-recipes-042838ec4263950c62f5c1c978dbcd0d529719a1.zip
Fix: Infomaniak unread messages badge to exclude spam emails (#273)
Diffstat (limited to 'recipes')
-rw-r--r--recipes/infomaniak-mail/package.json2
-rw-r--r--recipes/infomaniak-mail/webview.js20
2 files changed, 18 insertions, 4 deletions
diff --git a/recipes/infomaniak-mail/package.json b/recipes/infomaniak-mail/package.json
index 64a9e91..a90ce82 100644
--- a/recipes/infomaniak-mail/package.json
+++ b/recipes/infomaniak-mail/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "infomaniak-mail", 2 "id": "infomaniak-mail",
3 "name": "Infomaniak Mail", 3 "name": "Infomaniak Mail",
4 "version": "1.2.0", 4 "version": "1.3.0",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://mail.infomaniak.com/" 7 "serviceURL": "https://mail.infomaniak.com/"
diff --git a/recipes/infomaniak-mail/webview.js b/recipes/infomaniak-mail/webview.js
index 940eb82..23516b2 100644
--- a/recipes/infomaniak-mail/webview.js
+++ b/recipes/infomaniak-mail/webview.js
@@ -1,8 +1,22 @@
1module.exports = Ferdium => { 1module.exports = Ferdium => {
2 const getMessages = () => { 2 const getMessages = () => {
3 const count = document.querySelector('.ws-tree-node-badge'); 3 // This selects the first folder (the inbox and reads its unread messages count)
4 const countText = count ? count.textContent : null; 4 const inboxField = document.querySelector('.ws-tree-node-content')
5 Ferdium.setBadge(count && countText ? Number(countText) : 0); 5 const inboxCountField = inboxField.querySelector('.ws-tree-node-badge');
6 const inboxCountText = inboxCountField ? inboxCountField.textContent : null;
7 const inboxCount = inboxCountText ? Ferdium.safeParseInt(inboxCountText) : 0;
8
9 let unimportantCount = 0;
10
11 if (inboxCount === 0) {
12 // This selects the first folder with an unread message count.
13 // The actaul count and the total of all other folders is not needed as the badge has no number.
14 const totalCountField = document.querySelector('.ws-tree-node-badge');
15 const totalCountText = totalCountField ? totalCountField.textContent : null;
16 unimportantCount = totalCountText ? Ferdium.safeParseInt(totalCountText) : 0;
17 }
18
19 Ferdium.setBadge(inboxCount, unimportantCount);
6 }; 20 };
7 21
8 Ferdium.loop(getMessages); 22 Ferdium.loop(getMessages);