switch badge count to per-conversation, and add per-room badges

This commit is contained in:
Matthew Hodgson 2016-05-17 11:14:12 +01:00
parent 5bde32f7fe
commit fd09d5c570
2 changed files with 7 additions and 4 deletions

View File

@ -999,9 +999,12 @@ 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].hasMembershipState(MatrixClientPeg.get().credentials.userId, 'invite')) { if (rooms[i].hasMembershipState(MatrixClientPeg.get().credentials.userId, 'invite')) {
++notifCount; notifCount++;
} else if (rooms[i].getUnreadNotificationCount()) { } else if (rooms[i].getUnreadNotificationCount()) {
notifCount += rooms[i].getUnreadNotificationCount(); // if we were summing unread notifs:
// notifCount += rooms[i].getUnreadNotificationCount();
// instead, we just count the number of rooms with notifs.
notifCount++;
} }
} }
try { try {

View File

@ -83,7 +83,7 @@ module.exports = React.createClass({
name = name.replace(":", ":\u200b"); // add a zero-width space to allow linewrapping after the colon name = name.replace(":", ":\u200b"); // add a zero-width space to allow linewrapping after the colon
var badge; var badge;
if (this.props.highlight || notificationCount > 0) { if (this.props.highlight || notificationCount > 0) {
badge = <div className="mx_RoomTile_badge"/>; badge = <div className="mx_RoomTile_badge">{ notificationCount ? notificationCount : '!' }</div>;
} }
/* /*
if (this.props.highlight) { if (this.props.highlight) {
@ -132,9 +132,9 @@ module.exports = React.createClass({
<div className={classes} onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}> <div className={classes} onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<div className="mx_RoomTile_avatar"> <div className="mx_RoomTile_avatar">
<RoomAvatar room={this.props.room} width={24} height={24} /> <RoomAvatar room={this.props.room} width={24} height={24} />
{ badge }
</div> </div>
{ label } { label }
{ badge }
{ incomingCallBox } { incomingCallBox }
</div> </div>
)); ));