Fix mention count becomes twice or unexpected string
1. 'badge-notify' exists on navbar-toggle in mobile layout. It has also 'badge' class, so the mention count became twice. 2. [] accessor was missing in counting.
This commit is contained in:
@@ -170,7 +170,7 @@ var TabBar = React.createClass({
|
||||
mentionCount = thisObj.props.mentionCounts[index];
|
||||
}
|
||||
if (thisObj.props.mentionAtActiveCounts[index] > 0) {
|
||||
mentionCount += thisObj.props.mentionAtActiveCounts;
|
||||
mentionCount += thisObj.props.mentionAtActiveCounts[index];
|
||||
}
|
||||
|
||||
var badge;
|
||||
|
@@ -15,13 +15,11 @@ var unreadCountTimer = setInterval(function() {
|
||||
// unreadCount in sidebar
|
||||
// Note: the active channel doesn't have '.unread-title'.
|
||||
var unreadCount = document.getElementsByClassName('unread-title').length;
|
||||
// mentionCount in sidebar
|
||||
var elem = document.getElementsByClassName('badge')
|
||||
// mentionCount in mobile navbar-toggle
|
||||
var mentionBadge = document.getElementsByClassName('badge-notify');
|
||||
var mentionCount = 0;
|
||||
for (var i = 0; i < elem.length; i++) {
|
||||
if (isElementVisible(elem[i])) {
|
||||
mentionCount += Number(elem[i].innerHTML);
|
||||
}
|
||||
if (mentionBadge.length > 0) { // older mattermost doesn't have badges.
|
||||
mentionCount = Number(mentionBadge[0].innerHTML);
|
||||
}
|
||||
|
||||
var postAttrName = 'data-reactid';
|
||||
|
Reference in New Issue
Block a user