From 6eede9d84b25c47966291447cf072035acaaabcc Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 23 Feb 2024 19:53:37 +0100 Subject: [PATCH] Add notification badge feature back --- .../flavours/glitch/features/compose/index.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/features/compose/index.jsx b/app/javascript/flavours/glitch/features/compose/index.jsx index 35743bbd16..0bba28b787 100644 --- a/app/javascript/flavours/glitch/features/compose/index.jsx +++ b/app/javascript/flavours/glitch/features/compose/index.jsx @@ -52,6 +52,8 @@ const messages = defineMessages({ const mapStateToProps = (state, ownProps) => ({ columns: state.getIn(['settings', 'columns']), showSearch: ownProps.multiColumn ? state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']) : false, + unreadNotifications: state.getIn(['notifications', 'unread']), + showNotificationsBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']), }); // ~4% chance you'll end up with an unexpected friend @@ -66,6 +68,8 @@ class Compose extends PureComponent { columns: ImmutablePropTypes.list.isRequired, multiColumn: PropTypes.bool, showSearch: PropTypes.bool, + unreadNotifications: PropTypes.number, + showNotificationsBadge: PropTypes.bool, intl: PropTypes.object.isRequired, }; @@ -124,7 +128,7 @@ class Compose extends PureComponent { }; render () { - const { multiColumn, showSearch, intl } = this.props; + const { multiColumn, showSearch, showNotificationsBadge, unreadNotifications, intl } = this.props; const elefriend = [glitchedElephant1, glitchedElephant2, glitchedElephant3, elephantUIPlane][this.state.elefriend]; @@ -139,7 +143,12 @@ class Compose extends PureComponent { )} {!columns.some(column => column.get('id') === 'NOTIFICATIONS') && ( - + + + + {showNotificationsBadge && unreadNotifications > 0 &&
} + + )} {!columns.some(column => column.get('id') === 'COMMUNITY') && (