From f82f019aa993f346c8997d88944c055a377e3f37 Mon Sep 17 00:00:00 2001 From: Bauke van der Woude <6784391+baukevdw@users.noreply.github.com> Date: Tue, 11 Jan 2022 23:57:30 +0100 Subject: Fix Infomaniak unread messages count (#817) --- recipes/infomaniak-mail/webview.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/recipes/infomaniak-mail/webview.js b/recipes/infomaniak-mail/webview.js index f4e39dc..4d8b006 100644 --- a/recipes/infomaniak-mail/webview.js +++ b/recipes/infomaniak-mail/webview.js @@ -1,15 +1,8 @@ module.exports = Ferdi => { const getMessages = () => { const count = document.querySelector('.ws-tree-node-badge'); - if (count) { - const countText = count.textContent; - if (countText) { - Ferdi.setBadge( - // eslint-disable-next-line unicorn/prefer-string-slice - count ? Number(countText.substring(1, countText.length - 1)) : 0, - ); - } - } + const countText = count ? count.textContent : null; + Ferdi.setBadge(count && countText ? Number(countText.substring(1, countText.length - 1)) : 0); }; Ferdi.loop(getMessages); -- cgit v1.2.3-54-g00ecf