Merge branch 'notif-counters' into 'develop'
Chats: count only unread *chats* not total unread messages for counter See merge request soapbox-pub/soapbox-fe!291
This commit is contained in:
commit
dc23eff7cd
3 changed files with 6 additions and 6 deletions
|
@ -4,10 +4,10 @@ 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 notifications = state.getIn(['notifications', 'unread'], 0);
|
||||
const chats = state.get('chats').reduce((acc, curr) => acc + Math.min(curr.get('unread', 0), 1), 0);
|
||||
const reports = state.getIn(['admin', 'open_report_count'], 0);
|
||||
return notifications + chats + reports;
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
|
|
|
@ -29,7 +29,7 @@ const mapStateToProps = state => {
|
|||
|
||||
return {
|
||||
panesData: addChatsToPanes(state, panesData),
|
||||
unreadCount: state.get('chats').reduce((acc, curr) => acc + curr.get('unread'), 0),
|
||||
unreadCount: state.get('chats').reduce((acc, curr) => acc + Math.min(curr.get('unread', 0), 1), 0),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
|||
import IconWithBadge from 'soapbox/components/icon_with_badge';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
count: state.get('chats').reduce((acc, curr) => acc + curr.get('unread'), 0),
|
||||
count: state.get('chats').reduce((acc, curr) => acc + Math.min(curr.get('unread', 0), 1), 0),
|
||||
id: 'comment',
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue