aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-05-28 20:00:37 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-28 20:00:37 +0200
commit9d863a62a4f33ed20ba8cc49ac0619d9599735c3 (patch)
tree7c0b30316f89decff8d5698b0449a5fba6e4228b
parentScreen share refactoring (#1460) (diff)
downloadferdi-9d863a62a4f33ed20ba8cc49ac0619d9599735c3.tar.gz
ferdi-9d863a62a4f33ed20ba8cc49ac0619d9599735c3.tar.zst
ferdi-9d863a62a4f33ed20ba8cc49ac0619d9599735c3.zip
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
-rw-r--r--src/stores/ServicesStore.js2
-rw-r--r--src/webview/lib/RecipeWebview.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index dc2cb0db..11915bc4 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -583,7 +583,7 @@ export default class ServicesStore extends Store {
583 this._shareSettingsWithServiceProcess(); 583 this._shareSettingsWithServiceProcess();
584 } else if (channel === 'alive') { 584 } else if (channel === 'alive') {
585 service.lastPollAnswer = Date.now(); 585 service.lastPollAnswer = Date.now();
586 } else if (channel === 'messages') { 586 } else if (channel === 'message-counts') {
587 debug(`Received unread message info from '${serviceId}'`, args[0]); 587 debug(`Received unread message info from '${serviceId}'`, args[0]);
588 588
589 this.actions.service.setUnreadMessageCount({ 589 this.actions.service.setUnreadMessageCount({
diff --git a/src/webview/lib/RecipeWebview.js b/src/webview/lib/RecipeWebview.js
index bb205210..bef4b78e 100644
--- a/src/webview/lib/RecipeWebview.js
+++ b/src/webview/lib/RecipeWebview.js
@@ -55,12 +55,12 @@ class RecipeWebview {
55 const indirectInt = parseInt(indirect, 10); 55 const indirectInt = parseInt(indirect, 10);
56 56
57 const count = { 57 const count = {
58 direct: directInt > 0 ? directInt : 0, 58 direct: Math.max(directInt, 0),
59 indirect: indirectInt > 0 ? indirectInt : 0, 59 indirect: Math.max(indirectInt, 0),
60 }; 60 };
61 61
62 62
63 ipcRenderer.sendToHost('messages', count); 63 ipcRenderer.sendToHost('message-counts', count);
64 Object.assign(this.countCache, count); 64 Object.assign(this.countCache, count);
65 65
66 debug('Sending badge count to host', count); 66 debug('Sending badge count to host', count);