From 9d863a62a4f33ed20ba8cc49ac0619d9599735c3 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 28 May 2021 20:00:37 +0200 Subject: Clean up RecipeWebview.setBadge (#1461) Extracted from 240c3a72363e7388779c9ed3c6467ec63bb64d94 according to https://github.com/getferdi/ferdi/pull/1456#discussion_r641182688 and https://github.com/getferdi/ferdi/pull/1456#discussion_r641183662 --- src/stores/ServicesStore.js | 2 +- src/webview/lib/RecipeWebview.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index dc2cb0dbd..11915bc44 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js @@ -583,7 +583,7 @@ export default class ServicesStore extends Store { this._shareSettingsWithServiceProcess(); } else if (channel === 'alive') { service.lastPollAnswer = Date.now(); - } else if (channel === 'messages') { + } else if (channel === 'message-counts') { debug(`Received unread message info from '${serviceId}'`, args[0]); this.actions.service.setUnreadMessageCount({ diff --git a/src/webview/lib/RecipeWebview.js b/src/webview/lib/RecipeWebview.js index bb2052107..bef4b78ef 100644 --- a/src/webview/lib/RecipeWebview.js +++ b/src/webview/lib/RecipeWebview.js @@ -55,12 +55,12 @@ class RecipeWebview { const indirectInt = parseInt(indirect, 10); const count = { - direct: directInt > 0 ? directInt : 0, - indirect: indirectInt > 0 ? indirectInt : 0, + direct: Math.max(directInt, 0), + indirect: Math.max(indirectInt, 0), }; - ipcRenderer.sendToHost('messages', count); + ipcRenderer.sendToHost('message-counts', count); Object.assign(this.countCache, count); debug('Sending badge count to host', count); -- cgit v1.2.3-54-g00ecf