about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/drawer
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/drawer
parentba4521b175a2d0906e2a62e93e39cb80fa9286c9 (diff)
Add preferences for notification badges
Diffstat (limited to 'app/javascript/flavours/glitch/features/drawer')
-rw-r--r--app/javascript/flavours/glitch/features/drawer/header/index.js4
-rw-r--r--app/javascript/flavours/glitch/features/drawer/index.js4
2 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/drawer/header/index.js b/app/javascript/flavours/glitch/features/drawer/header/index.js
index 435538de4..7fefd32c9 100644
--- a/app/javascript/flavours/glitch/features/drawer/header/index.js
+++ b/app/javascript/flavours/glitch/features/drawer/header/index.js
@@ -47,6 +47,7 @@ const messages = defineMessages({
 export default function DrawerHeader ({
   columns,
   unreadNotifications,
+  showNotificationsBadge,
   intl,
   onSettingsClick,
 }) {
@@ -81,7 +82,7 @@ export default function DrawerHeader ({
         >
           <span className='icon-badge-wrapper'>
             <Icon icon='bell' />
-            { unreadNotifications > 0 && <div className='icon-badge' />}
+            { showNotificationsBadge && unreadNotifications > 0 && <div className='icon-badge' />}
           </span>
         </Link>
       ))}
@@ -119,6 +120,7 @@ export default function DrawerHeader ({
 DrawerHeader.propTypes = {
   columns: ImmutablePropTypes.list,
   unreadNotifications: PropTypes.number,
+  showNotificationsBadge: PropTypes.bool,
   intl: PropTypes.object,
   onSettingsClick: PropTypes.func,
 };
diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js
index e8d9c86cb..72b36fcae 100644
--- a/app/javascript/flavours/glitch/features/drawer/index.js
+++ b/app/javascript/flavours/glitch/features/drawer/index.js
@@ -35,6 +35,7 @@ const mapStateToProps = state => ({
   searchValue: state.getIn(['search', 'value']),
   submitted: state.getIn(['search', 'submitted']),
   unreadNotifications: state.getIn(['notifications', 'unread']),
+  showNotificationsBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']),
 });
 
 //  Dispatch mapping.
@@ -89,6 +90,7 @@ class Drawer extends React.Component {
       submitted,
       isSearchPage,
       unreadNotifications,
+      showNotificationsBadge,
     } = this.props;
     const computedClass = classNames('drawer', `mbstobon-${elefriend}`);
 
@@ -99,6 +101,7 @@ class Drawer extends React.Component {
           <DrawerHeader
             columns={columns}
             unreadNotifications={unreadNotifications}
+            showNotificationsBadge={showNotificationsBadge}
             intl={intl}
             onSettingsClick={onOpenSettings}
           />
@@ -143,6 +146,7 @@ Drawer.propTypes = {
   searchValue: PropTypes.string,
   submitted: PropTypes.bool,
   unreadNotifications: PropTypes.number,
+  showNotificationsBadge: PropTypes.bool,
 
   //  Dispatch props.
   onChange: PropTypes.func,