Commit 080dafee authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix for javascript update of unread message count

Now that the unread message count has been removed from the profile
sideblock (see commit 8b4933e1

), the
javascript updateUnreadCount function needs to be modified to read the
existing count from the top-right header rather than the profile
sideblock.

Change-Id: I349c4900d0eff4dcbdaaf318513e4c8c20a73cf9
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 2ae923c0
......@@ -700,28 +700,19 @@ function quotaUpdate(quotaused, quota) {
function updateUnreadCount(n, decrement) {
var newcount = -1;
forEach(getElementsByTagAndClassName('span', 'unreadmessagescontainer'), function(message) {
var countnode = message.firstChild;
if (decrement == 'decrement') {
var oldcount = parseInt(countnode.innerHTML);
newcount = (oldcount - n);
}
else {
newcount = n;
}
var messagenode = message.lastChild;
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;
});
var countnode = getFirstElementByTagAndClassName('span', 'unreadmessagecount', 'right-nav');
if (!countnode) {
return;
}
if (decrement == 'decrement') {
var oldcount = parseInt(countnode.innerHTML);
newcount = (oldcount - n);
}
else {
newcount = n;
}
if (newcount > -1) {
forEach(getElementsByTagAndClassName('span', 'unreadmessagecount', 'right-nav'), function(element) {
element.innerHTML = newcount;
});
countnode.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