From c0f1ae013346b32480c217729727d899be4e46cb Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Jan 2016 18:29:27 +0000 Subject: [PATCH] Use Unread to compute unread status of a room (which uses read receipts). --- src/components/structures/RoomSubList.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 0a0660f8..48dd334e 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -20,7 +20,7 @@ var React = require('react'); var DropTarget = require('react-dnd').DropTarget; var sdk = require('matrix-react-sdk') var dis = require('matrix-react-sdk/lib/dispatcher'); -var UnreadStatus = require('matrix-react-sdk/lib/UnreadStatus'); +var Unread = require('matrix-react-sdk/lib/Unread'); // turn this on for drop & drag console debugging galore var debug = false; @@ -62,7 +62,6 @@ var RoomSubList = React.createClass({ editable: React.PropTypes.bool, order: React.PropTypes.string.isRequired, selectedRoom: React.PropTypes.string.isRequired, - activityMap: React.PropTypes.object.isRequired, startAsHidden: React.PropTypes.bool, showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded @@ -108,8 +107,7 @@ var RoomSubList = React.createClass({ tsOfNewestEvent: function(room) { for (var i = room.timeline.length - 1; i >= 0; --i) { var ev = room.timeline[i]; - // logic copied from RoomList.js for when we do/don't highlight - if (UnreadStatus.eventTriggersUnreadCount(ev)) { + if (Unread.eventTriggersUnreadCount(ev)) { return ev.getTs(); } } @@ -254,7 +252,7 @@ var RoomSubList = React.createClass({ key={ room.roomId } collapsed={ self.props.collapsed || false} selected={ selected } - unread={ self.props.activityMap[room.roomId] === 1 } + unread={ Unread.doesRoomHaveUnreadMessages(room) } highlight={ room.unread_notification_count > 0 || self.props.label === 'Invites' } isInvite={ self.props.label === 'Invites' } incomingCall={ self.props.incomingCall && (self.props.incomingCall.roomId === room.roomId) ? self.props.incomingCall : null }