Chats: count only unread *chats* not total unread messages for counter

chats_delete_account
Alex Gleason 2020-10-02 20:01:09 -05:00
rodzic 2a077aca84
commit 17266e172f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -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 => ({

Wyświetl plik

@ -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),
};
};

Wyświetl plik

@ -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',
});