Commit 45f2009d authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge "Fix for javascript update of unread message count"

parents 2ae923c0 080dafee
...@@ -700,28 +700,19 @@ function quotaUpdate(quotaused, quota) { ...@@ -700,28 +700,19 @@ function quotaUpdate(quotaused, quota) {
function updateUnreadCount(n, decrement) { function updateUnreadCount(n, decrement) {
var newcount = -1; var newcount = -1;
forEach(getElementsByTagAndClassName('span', 'unreadmessagescontainer'), function(message) { var countnode = getFirstElementByTagAndClassName('span', 'unreadmessagecount', 'right-nav');
var countnode = message.firstChild; if (!countnode) {
if (decrement == 'decrement') { return;
var oldcount = parseInt(countnode.innerHTML); }
newcount = (oldcount - n); if (decrement == 'decrement') {
} var oldcount = parseInt(countnode.innerHTML);
else { newcount = (oldcount - n);
newcount = n; }
} else {
var messagenode = message.lastChild; newcount = n;
if (newcount == 1) { // jump through hoops to change between plural and singular }
messagenode.innerHTML = get_string('unreadmessage');
}
else {
messagenode.innerHTML = get_string('unreadmessages');
}
countnode.innerHTML = newcount;
});
if (newcount > -1) { if (newcount > -1) {
forEach(getElementsByTagAndClassName('span', 'unreadmessagecount', 'right-nav'), function(element) { countnode.innerHTML = newcount;
element.innerHTML = newcount;
});
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment