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];
|
mentionCount = thisObj.props.mentionCounts[index];
|
||||||
}
|
}
|
||||||
if (thisObj.props.mentionAtActiveCounts[index] > 0) {
|
if (thisObj.props.mentionAtActiveCounts[index] > 0) {
|
||||||
mentionCount += thisObj.props.mentionAtActiveCounts;
|
mentionCount += thisObj.props.mentionAtActiveCounts[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
var badge;
|
var badge;
|
||||||
|
@@ -15,13 +15,11 @@ var unreadCountTimer = setInterval(function() {
|
|||||||
// unreadCount in sidebar
|
// unreadCount in sidebar
|
||||||
// Note: the active channel doesn't have '.unread-title'.
|
// Note: the active channel doesn't have '.unread-title'.
|
||||||
var unreadCount = document.getElementsByClassName('unread-title').length;
|
var unreadCount = document.getElementsByClassName('unread-title').length;
|
||||||
// mentionCount in sidebar
|
// mentionCount in mobile navbar-toggle
|
||||||
var elem = document.getElementsByClassName('badge')
|
var mentionBadge = document.getElementsByClassName('badge-notify');
|
||||||
var mentionCount = 0;
|
var mentionCount = 0;
|
||||||
for (var i = 0; i < elem.length; i++) {
|
if (mentionBadge.length > 0) { // older mattermost doesn't have badges.
|
||||||
if (isElementVisible(elem[i])) {
|
mentionCount = Number(mentionBadge[0].innerHTML);
|
||||||
mentionCount += Number(elem[i].innerHTML);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var postAttrName = 'data-reactid';
|
var postAttrName = 'data-reactid';
|
||||||
|
Reference in New Issue
Block a user