@@ -217,22 +217,30 @@ var RoomSubList = React.createClass({
217217 return roomNotifState != RoomNotifs . MUTE ;
218218 } ,
219219
220- roomNotificationCount : function ( ) {
220+ /**
221+ * Total up all the notification counts from the rooms
222+ *
223+ * @param {Number } If supplied will only total notifications for rooms outside the truncation number
224+ * @returns {Array } The array takes the form [total, highlight] where highlight is a bool
225+ */
226+ roomNotificationCount : function ( truncateAt ) {
221227 var self = this ;
222228
223- return this . props . list . reduce ( function ( result , room ) {
224- var roomNotifState = RoomNotifs . getRoomNotifsState ( room . roomId ) ;
225- var highlight = room . getUnreadNotificationCount ( 'highlight' ) > 0 || self . props . label === 'Invites' ;
226- var notificationCount = room . getUnreadNotificationCount ( ) ;
229+ return this . props . list . reduce ( function ( result , room , index ) {
230+ if ( truncateAt === undefined || index >= truncateAt ) {
231+ var roomNotifState = RoomNotifs . getRoomNotifsState ( room . roomId ) ;
232+ var highlight = room . getUnreadNotificationCount ( 'highlight' ) > 0 || self . props . label === 'Invites' ;
233+ var notificationCount = room . getUnreadNotificationCount ( ) ;
227234
228- const notifBadges = notificationCount > 0 && self . _shouldShowNotifBadge ( roomNotifState ) ;
229- const mentionBadges = highlight && self . _shouldShowMentionBadge ( roomNotifState ) ;
230- const badges = notifBadges || mentionBadges ;
235+ const notifBadges = notificationCount > 0 && self . _shouldShowNotifBadge ( roomNotifState ) ;
236+ const mentionBadges = highlight && self . _shouldShowMentionBadge ( roomNotifState ) ;
237+ const badges = notifBadges || mentionBadges ;
231238
232- if ( badges ) {
233- result [ 0 ] += notificationCount ;
234- if ( highlight ) {
235- result [ 1 ] = true ;
239+ if ( badges ) {
240+ result [ 0 ] += notificationCount ;
241+ if ( highlight ) {
242+ result [ 1 ] = true ;
243+ }
236244 }
237245 }
238246 return result ;
@@ -423,11 +431,25 @@ var RoomSubList = React.createClass({
423431
424432 _createOverflowTile : function ( overflowCount , totalCount ) {
425433 var content = < div className = "mx_RoomSubList_chevronDown" > </ div > ;
434+
435+ var overflowNotifications = this . roomNotificationCount ( TRUNCATE_AT ) ;
436+ var overflowNotifCount = overflowNotifications [ 0 ] ;
437+ var overflowNotifHighlight = overflowNotifications [ 1 ] ;
438+ if ( overflowNotifCount && ! this . props . collapsed ) {
439+ content = overflowNotifCount ;
440+ }
441+
442+ var badgeClasses = classNames ( {
443+ 'mx_RoomSubList_moreBadge' : true ,
444+ 'mx_RoomSubList_moreBadgeNotify' : overflowNotifCount && ! this . props . collapsed ,
445+ 'mx_RoomSubList_moreBadgeHighlight' : overflowNotifHighlight && ! this . props . collapsed ,
446+ } ) ;
447+
426448 return (
427449 < div className = "mx_RoomSubList_ellipsis" onClick = { this . _showFullMemberList } >
428450 < div className = "mx_RoomSubList_line" > </ div >
429451 < div className = "mx_RoomSubList_more" > more</ div >
430- < div className = "mx_RoomSubList_moreBadge" > { content } </ div >
452+ < div className = { badgeClasses } > { content } </ div >
431453 </ div >
432454 ) ;
433455 } ,
0 commit comments