Address PR comments

This commit is contained in:
David Baker 2016-01-07 10:38:44 +00:00
parent 05d9e1261c
commit 287da54fbc
2 changed files with 12 additions and 2 deletions

View file

@ -639,8 +639,10 @@ module.exports = React.createClass({
var rooms = MatrixClientPeg.get().getRooms(); var rooms = MatrixClientPeg.get().getRooms();
for (var i = 0; i < rooms.length; ++i) { for (var i = 0; i < rooms.length; ++i) {
if (rooms[i].unread_notification_count) {
notifCount += rooms[i].unread_notification_count; notifCount += rooms[i].unread_notification_count;
} }
}
this.favicon.badge(notifCount); this.favicon.badge(notifCount);
document.title = (notifCount > 0 ? "["+notifCount+"] " : "")+"Vector"; document.title = (notifCount > 0 ? "["+notifCount+"] " : "")+"Vector";
}, },

View file

@ -159,7 +159,15 @@ module.exports = React.createClass({
onRoomReceipt: function(receiptEvent, room) { onRoomReceipt: function(receiptEvent, room) {
// because if we read a notification, it will affect notification count // because if we read a notification, it will affect notification count
// only bother updating if there's a receipt from us
var receiptKeys = Object.keys(receiptEvent.getContent());
for (var i = 0; i < receiptKeys.length; ++i) {
var rcpt = receiptEvent.getContent()[receiptKeys[i]];
if (rcpt['m.read'] && rcpt['m.read'][MatrixClientPeg.get().credentials.userId]) {
this.refreshRoomList(); this.refreshRoomList();
break;
}
}
}, },
onRoomName: function(room) { onRoomName: function(room) {