Merge branch 'chat_tab_notifications' into 'develop'
Browser tab indicates total count of both Notifications and Unread Chat Messages. Fixes #385 Closes #385 See merge request soapbox-pub/soapbox-fe!199
This commit is contained in:
commit
66e36d5144
1 changed files with 8 additions and 1 deletions
|
@ -3,9 +3,16 @@ import { connect } from 'react-redux';
|
|||
import PropTypes from 'prop-types';
|
||||
import { Helmet } from'react-helmet';
|
||||
|
||||
const getNotifTotals = state => {
|
||||
const normNotif = state.getIn(['notifications', 'unread']);
|
||||
const chatNotif = state.get('chats').reduce((acc, curr) => acc + curr.get('unread'), 0);
|
||||
const notifTotals = normNotif + chatNotif;
|
||||
return notifTotals;
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
siteTitle: state.getIn(['instance', 'title']),
|
||||
unreadCount: state.getIn(['notifications', 'unread']),
|
||||
unreadCount: getNotifTotals(state),
|
||||
});
|
||||
|
||||
class SoapboxHelmet extends React.Component {
|
||||
|
|
Loading…
Reference in a new issue