From aa244f76cb03f9e10e3657503abb1bf5f6475fbb Mon Sep 17 00:00:00 2001 From: Edmundo Sanchez Date: Mon, 17 Oct 2022 09:49:41 -0500 Subject: Fix: Unread count stays at 1 when all emails are read (#178) - Element that contains the unread count dissapears when count is zero. - Added that scenario to reset th ecount to zero and send it to the badge Co-authored-by: Vijay A --- recipes/onmail/webview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'recipes/onmail/webview.js') diff --git a/recipes/onmail/webview.js b/recipes/onmail/webview.js index 8565d76..9e881f4 100644 --- a/recipes/onmail/webview.js +++ b/recipes/onmail/webview.js @@ -10,7 +10,9 @@ module.exports = Ferdium => { const inboxLinks = document.querySelectorAll('p.truncate'); for (const label of inboxLinks){ if (label.textContent) { - countImportant = Ferdium.safeParseInt(label.nextSibling.textContent); + let inbox_count = label.nextSibling + countImportant = inbox_count == null ? 0 : Ferdium.safeParseInt(inbox_count.textContent); + break; } } -- cgit v1.2.3-70-g09d2