diff options
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 22c376c06..e79677400 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -488,19 +488,28 @@ 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 | |||
494 | // TODO: unfinished monkey business | ||
495 | |||
491 | const unreadDirectMessageCount = this.enabled | 496 | const unreadDirectMessageCount = this.enabled |
497 | .filter(s => (showMessageBadgeWhenMuted || s.isNotificationEnabled) && showMessageBadgesEvenWhenMuted) | ||
492 | .map(s => s.unreadDirectMessageCount) | 498 | .map(s => s.unreadDirectMessageCount) |
493 | .reduce((a, b) => a + b, 0); | 499 | .reduce((a, b) => a + b, 0); |
494 | 500 | ||
495 | const unreadIndirectMessageCount = this.enabled | 501 | const unreadIndirectMessageCount = this.enabled |
496 | .filter(s => s.isIndirectMessageBadgeEnabled) | 502 | // .filter(s => s.isIndirectMessageBadgeEnabled && (s.isNotificationEnabled && showMessageBadgeWhenMuted)) |
497 | .map(s => s.unreadIndirectMessageCount) | 503 | .map(s => s.unreadIndirectMessageCount) |
498 | .reduce((a, b) => a + b, 0); | 504 | .reduce((a, b) => a + b, 0); |
499 | 505 | ||
500 | this.actions.app.setBadge({ | 506 | // 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, | 507 | if (showMessageBadgesEvenWhenMuted) { |
502 | unreadIndirectMessageCount, | 508 | this.actions.app.setBadge({ |
503 | }); | 509 | unreadDirectMessageCount, |
510 | unreadIndirectMessageCount, | ||
511 | }); | ||
512 | } | ||
504 | } | 513 | } |
505 | 514 | ||
506 | _logoutReaction() { | 515 | _logoutReaction() { |