From 0605d960140fb9b0ca737905150ca08ef59a66f4 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 16 Feb 2018 11:02:52 +0000 Subject: [PATCH] Only use DNDRoomTile for editable sub lists Otherwise, the DND tile will expect to be within a Droppable, which is not supported by react-beautiful-dnd. This was causing errors when receiving an invite. Fixes #6144 --- src/components/structures/RoomSubList.js | 41 ++++++++++++------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index d119e2714..70e5b1851 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -194,26 +194,27 @@ var RoomSubList = React.createClass({ }, makeRoomTiles: function() { - var self = this; - var DNDRoomTile = sdk.getComponent("rooms.DNDRoomTile"); - return this.state.sortedList.map(function(room, index) { - // XXX: is it evil to pass in self as a prop to RoomTile? - return ( - 0 || self.props.isInvite } - isInvite={ self.props.isInvite } - refreshSubList={ self._updateSubListCount } - incomingCall={ null } - onClick={ self.onRoomTileClick } - /> - ); + const DNDRoomTile = sdk.getComponent("rooms.DNDRoomTile"); + const RoomTile = sdk.getComponent("rooms.RoomTile"); + return this.state.sortedList.map((room, index) => { + // XXX: is it evil to pass in this as a prop to RoomTile? Yes. + + // We should only use when editable + const RoomTileComponent = this.props.editable ? DNDRoomTile : RoomTile; + return 0 || this.props.isInvite} + isInvite={this.props.isInvite} + refreshSubList={this._updateSubListCount} + incomingCall={null} + onClick={this.onRoomTileClick} + />; }); },