diff --git a/packages/rocketchat-ui-sidenav/client/roomList.html b/packages/rocketchat-ui-sidenav/client/roomList.html index ca46375f66c..fe836bf07bf 100644 --- a/packages/rocketchat-ui-sidenav/client/roomList.html +++ b/packages/rocketchat-ui-sidenav/client/roomList.html @@ -2,32 +2,32 @@ {{#if isLivechat}} {{> livechat . }} {{else}} - {{#if isActiveFavorite}} - {{#with rooms}} - - + {{#with rooms}} + {{#if shouldAppear .. rooms}} + + - {{#if hasMoreChannelsButton ..}} - {{!----}} - {{/if}} + {{#if hasMoreChannelsButton ..}} + {{!----}} + {{/if}} - {{#if hasMoreGroupsButton ..}} - {{!----}} + {{#if hasMoreGroupsButton ..}} + {{!----}} + {{/if}} {{/if}} - {{/with}} - {{/if}} + {{/with}} {{/if}} diff --git a/packages/rocketchat-ui-sidenav/client/roomList.js b/packages/rocketchat-ui-sidenav/client/roomList.js index 9854b2db7ac..ae0226476a3 100644 --- a/packages/rocketchat-ui-sidenav/client/roomList.js +++ b/packages/rocketchat-ui-sidenav/client/roomList.js @@ -49,21 +49,16 @@ Template.roomList.helpers({ return this.identifier === 'l'; }, - unreadClass(room) { - let classes = ''; - - if (room.unread) { - const user = Meteor.user(); - classes += 'unread-rooms-mode'; - - if ((user && user.settings && user.settings.preferences && user.settings.preferences.unreadRoomsMode) && (Template.instance().unreadRooms.count())) { - classes += ' has-unread'; - } - } - - return classes; + shouldAppear(group, rooms) { + /* + if is a normal group ('channel' 'private' 'direct') + or is favorite and has one room + or is unread and has one room + */ + const nonFavorite = group.identifier || group.unread; + const showNormalRooms = !group.unread || Template.instance().unreadRooms.count(); + return showNormalRooms && nonFavorite || !group.unread && !this.anonymous && rooms.count(); }, - hasMoreChannelsButton(room) { return room.identifier === 'c' || room.anonymous; }, diff --git a/packages/rocketchat-ui-sidenav/client/sideNav.js b/packages/rocketchat-ui-sidenav/client/sideNav.js index 291bbb0153c..6f94acd2272 100644 --- a/packages/rocketchat-ui-sidenav/client/sideNav.js +++ b/packages/rocketchat-ui-sidenav/client/sideNav.js @@ -1,6 +1,10 @@ /* globals menu*/ Template.sideNav.helpers({ + hasUnread() { + const user = Meteor.user(); + return user && user.settings && user.settings.preferences && user.settings.preferences.unreadRoomsMode; + }, flexTemplate() { return SideNav.getFlex().template; },