aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/ServicesStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r--src/stores/ServicesStore.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 22c376c06..b04aafd78 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -488,19 +488,26 @@ export default class ServicesStore extends Store {
488 } 488 }
489 489
490 _getUnreadMessageCountReaction() { 490 _getUnreadMessageCountReaction() {
491 const showMessageBadgeWhenMuted = this.stores.settings.all.showMessageBadgeWhenMuted;
492 const showMessageBadgesEvenWhenMuted = this.stores.ui.showMessageBadgesEvenWhenMuted;
493
491 const unreadDirectMessageCount = this.enabled 494 const unreadDirectMessageCount = this.enabled
495 .filter(s => (showMessageBadgeWhenMuted || s.isNotificationEnabled) && showMessageBadgesEvenWhenMuted)
492 .map(s => s.unreadDirectMessageCount) 496 .map(s => s.unreadDirectMessageCount)
493 .reduce((a, b) => a + b, 0); 497 .reduce((a, b) => a + b, 0);
494 498
495 const unreadIndirectMessageCount = this.enabled 499 const unreadIndirectMessageCount = this.enabled
496 .filter(s => s.isIndirectMessageBadgeEnabled) 500 .filter(s => (showMessageBadgeWhenMuted || s.isIndirectMessageBadgeEnabled) && showMessageBadgesEvenWhenMuted)
497 .map(s => s.unreadIndirectMessageCount) 501 .map(s => s.unreadIndirectMessageCount)
498 .reduce((a, b) => a + b, 0); 502 .reduce((a, b) => a + b, 0);
499 503
500 this.actions.app.setBadge({ 504 // We can't just block this earlier, otherwise the mobx reaction won't be aware of the vars to watch in some cases
501 unreadDirectMessageCount, 505 if (showMessageBadgesEvenWhenMuted) {
502 unreadIndirectMessageCount, 506 this.actions.app.setBadge({
503 }); 507 unreadDirectMessageCount,
508 unreadIndirectMessageCount,
509 });
510 }
504 } 511 }
505 512
506 _logoutReaction() { 513 _logoutReaction() {