From 1c387c1fd12c58a41e26b57c3414d5ca0399405e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 27 Aug 2017 23:37:13 +0100 Subject: [PATCH 1/2] fix two room list regressions: + missing roomsublist badge for invites + missing room badge for invites if i18n!=English Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomSubList.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 7c6b16229c..fc9b30b848 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -78,6 +78,9 @@ var RoomSubList = React.createClass({ // undefined if no room is selected (eg we are showing settings) selectedRoom: React.PropTypes.string, + // pass explicitly, do not rely on label==='Invites' because i18n. + isInvite: React.PropTypes.bool, + startAsHidden: React.PropTypes.bool, showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded collapsed: React.PropTypes.bool.isRequired, // is LeftPanel collapsed? @@ -246,7 +249,7 @@ var RoomSubList = React.createClass({ return this.props.list.reduce(function(result, room, index) { if (truncateAt === undefined || index >= truncateAt) { var roomNotifState = RoomNotifs.getRoomNotifsState(room.roomId); - var highlight = room.getUnreadNotificationCount('highlight') > 0 || self.props.label === 'Invites'; + var highlight = room.getUnreadNotificationCount('highlight') > 0 || self.props.isInvite; var notificationCount = room.getUnreadNotificationCount(); const notifBadges = notificationCount > 0 && self._shouldShowNotifBadge(roomNotifState); @@ -376,8 +379,8 @@ var RoomSubList = React.createClass({ collapsed={ self.props.collapsed || false} selected={ selected } unread={ Unread.doesRoomHaveUnreadMessages(room) } - highlight={ room.getUnreadNotificationCount('highlight') > 0 || self.props.label === 'Invites' } - isInvite={ self.props.label === 'Invites' } + highlight={ room.getUnreadNotificationCount('highlight') > 0 || self.props.isInvite } + isInvite={ self.props.isInvite } refreshSubList={ self._updateSubListCount } incomingCall={ null } onClick={ self.onRoomTileClick } @@ -409,6 +412,9 @@ var RoomSubList = React.createClass({ var badge; if (subListNotifCount > 0) { badge =
{ FormattingUtils.formatCount(subListNotifCount) }
; + } else if (this.props.isInvite) { + // no notifications but highlight anyway because this is an invite badge + badge =
!
; } // When collapsed, allow a long hover on the header to show user From f560dc4c11ec67adef10c52a51aa8db834d3c6c8 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 29 Aug 2017 14:57:29 +0100 Subject: [PATCH 2/2] add useful comment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomSubList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index fc9b30b848..da5b120f7a 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -78,7 +78,7 @@ var RoomSubList = React.createClass({ // undefined if no room is selected (eg we are showing settings) selectedRoom: React.PropTypes.string, - // pass explicitly, do not rely on label==='Invites' because i18n. + // passed through to RoomTile and used to highlight room with `!` regardless of notifications count isInvite: React.PropTypes.bool, startAsHidden: React.PropTypes.bool,