[MM-38316] Remove mention and unread counts for current server from the dropdown button (#1729)

This commit is contained in:
Devin Binnie
2021-09-10 13:45:24 -04:00
committed by GitHub
parent 59189db86d
commit 313824b6df

View File

@@ -393,8 +393,20 @@ export default class MainPage extends React.PureComponent<Props, State> {
);
}
const totalMentionCount = Object.values(this.state.mentionCounts).reduce((sum, value) => sum + value, 0);
const totalUnreadCount = Object.values(this.state.unreadCounts).reduce((sum, value) => sum + value, 0);
const serverMatch = `${this.state.activeServerName}___TAB_[A-Z]+`;
const totalMentionCount = Object.keys(this.state.mentionCounts).reduce((sum, key) => {
// Strip out current server from unread and mention counts
if (this.state.activeServerName && key.match(serverMatch)) {
return sum;
}
return sum + this.state.mentionCounts[key];
}, 0);
const totalUnreadCount = Object.keys(this.state.unreadCounts).reduce((sum, key) => {
if (this.state.activeServerName && key.match(serverMatch)) {
return sum;
}
return sum + this.state.unreadCounts[key];
}, 0);
const topRow = (
<Row
className={topBarClassName}