about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/ui/index.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-09-06 20:55:11 +0200
committerThibG <thib@sitedethib.com>2018-09-07 20:37:17 +0200
commit324ce93368bbac88a5b53083c8932ec175450f55 (patch)
tree019a413b5d4b20bad7114081e1df5afe4f01fe53 /app/javascript/flavours/glitch/features/ui/index.js
parentba4521b175a2d0906e2a62e93e39cb80fa9286c9 (diff)
Add preferences for notification badges
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/ui/index.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/index.js b/app/javascript/flavours/glitch/features/ui/index.js
index 3dd894383..064804b79 100644
--- a/app/javascript/flavours/glitch/features/ui/index.js
+++ b/app/javascript/flavours/glitch/features/ui/index.js
@@ -66,6 +66,7 @@ const mapStateToProps = state => ({
   navbarUnder: state.getIn(['local_settings', 'navbar_under']),
   dropdownMenuIsOpen: state.getIn(['dropdown_menu', 'openId']) !== null,
   unreadNotifications: state.getIn(['notifications', 'unread']),
+  showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']),
 });
 
 const keyMap = {
@@ -118,6 +119,7 @@ export default class UI extends React.Component {
     intl: PropTypes.object.isRequired,
     dropdownMenuIsOpen: PropTypes.bool,
     unreadNotifications: PropTypes.number,
+    showFaviconBadge: PropTypes.bool,
   };
 
   state = {
@@ -272,9 +274,10 @@ export default class UI extends React.Component {
     if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) {
       this.columnsAreaNode.handleChildrenContentChange();
     }
-    if (this.props.unreadNotifications != prevProps.unreadNotifications) {
+    if (this.props.unreadNotifications != prevProps.unreadNotifications ||
+        this.props.showFaviconBadge != prevProps.showFaviconBadge) {
       if (this.favicon) {
-        this.favicon.badge(this.props.unreadNotifications);
+        this.favicon.badge(this.props.showFaviconBadge ? this.props.unreadNotifications : 0);
       }
     }
   }