From 17b75a589faec42c44451e12351add1b79953ab0 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Fri, 9 Sep 2016 14:36:51 +0100 Subject: [PATCH] Added the little green men for direct message rooms --- src/components/views/rooms/RoomTile.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 79698e475d..54772b8a2f 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -21,6 +21,7 @@ var ReactDOM = require("react-dom"); var classNames = require('classnames'); var dis = require("../../../dispatcher"); var MatrixClientPeg = require('../../../MatrixClientPeg'); +var DMRoomMap = require('../../../utils/DMRoomMap'); var sdk = require('../../../index'); var ContextualMenu = require('../../structures/ContextualMenu'); var RoomNotifs = require('../../../RoomNotifs'); @@ -64,6 +65,16 @@ module.exports = React.createClass({ return this.state.notifState != RoomNotifs.MUTE; }, + _isDirectMessageRoom: function(roomId) { + const dmRoomMap = new DMRoomMap(MatrixClientPeg.get()); + var dmRooms = dmRoomMap.getUserIdForRoomId(roomId); + if (dmRooms) { + return true; + } else { + return false; + } + }, + onAccountData: function(accountDataEvent) { if (accountDataEvent.getType() == 'm.push_rules') { this.setState({ @@ -259,6 +270,11 @@ module.exports = React.createClass({ var RoomAvatar = sdk.getComponent('avatars.RoomAvatar'); + var directMessageIndicator; + if (this._isDirectMessageRoom(this.props.room)) { + directMessageIndicator = dm; + } + // These props are injected by React DnD, // as defined by your `collect` function above: var isDragging = this.props.isDragging; @@ -271,6 +287,7 @@ module.exports = React.createClass({
+ {directMessageIndicator}