From dfae2d231e39c81827d08fd8834d736c5b3005b1 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Tue, 31 Aug 2021 16:25:57 +0530 Subject: refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes. --- recipes/yammer/package.json | 2 +- recipes/yammer/webview.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'recipes/yammer') diff --git a/recipes/yammer/package.json b/recipes/yammer/package.json index 86b5bc6..f0a20d6 100644 --- a/recipes/yammer/package.json +++ b/recipes/yammer/package.json @@ -1,7 +1,7 @@ { "id": "yammer", "name": "Yammer", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "config": { "serviceURL": "https://www.yammer.com/login", diff --git a/recipes/yammer/webview.js b/recipes/yammer/webview.js index 91daba6..79d428f 100644 --- a/recipes/yammer/webview.js +++ b/recipes/yammer/webview.js @@ -5,12 +5,12 @@ module.exports = Ferdi => { const notificationElement = document.querySelector('.yj-notifications-indicator-count'); const newMessagesElement = document.querySelector('.yj-thread-list--new-messages-notice:not(.is-hidden) .yj-thread-list--new-message-text'); - if (notificationElement && notificationElement.innerHTML.length) { - directMessages = parseInt(notificationElement.innerHTML, 10); + if (notificationElement) { + directMessages = Ferdi.safeParseInt(notificationElement.innerHTML); } - if (newMessagesElement && newMessagesElement.innerHTML.length) { - indirectMessages = parseInt(newMessagesElement.innerHTML.match(/\d+/)[0], 10); + if (newMessagesElement) { + indirectMessages = Ferdi.safeParseInt(newMessagesElement.innerHTML.match(/\d+/)[0]); } Ferdi.setBadge(directMessages, indirectMessages); -- cgit v1.2.3-70-g09d2