diff --git a/src/controllers/organisms/RoomList.js b/src/controllers/organisms/RoomList.js index 3a03fb043..792fa04f7 100644 --- a/src/controllers/organisms/RoomList.js +++ b/src/controllers/organisms/RoomList.js @@ -135,11 +135,16 @@ module.exports = { getRoomLists: function() { var s = { lists: {} }; + s.lists["m.invite"] = []; + s.lists["m.favourite"] = []; + s.lists["m.recent"] = []; + s.lists["m.lowpriority"] = []; + s.lists["m.archived"] = []; + MatrixClientPeg.get().getRooms().forEach(function(room) { var me = room.getMember(MatrixClientPeg.get().credentials.userId); if (me && me.membership == "invite") { - s.lists["m.invite"] = s.lists["m.invite"] || []; s.lists["m.invite"].push(room); } else { @@ -172,7 +177,6 @@ module.exports = { } } else { - s.lists["m.recent"] = s.lists["m.recent"] || []; s.lists["m.recent"].push(room); } } diff --git a/src/skins/vector/views/molecules/RoomTile.js b/src/skins/vector/views/molecules/RoomTile.js index 9f7806959..a8f646aea 100644 --- a/src/skins/vector/views/molecules/RoomTile.js +++ b/src/skins/vector/views/molecules/RoomTile.js @@ -96,6 +96,7 @@ var roomTileSource = { } else { // cancel the drop and reset our original position + console.log("cancelling drop & drag"); props.roomSubList.moveRoomTile(item.room, item.originalIndex); if (item.targetList && item.targetList !== item.originalList) { item.targetList.removeRoomTile(item.room); @@ -111,13 +112,16 @@ var roomTileTarget = { hover: function(props, monitor) { var item = monitor.getItem(); - console.log("hovering on room " + props.room.roomId + ", isOver=" + monitor.isOver()); + //console.log("hovering on room " + props.room.roomId + ", isOver=" + monitor.isOver()); //console.log("item.targetList=" + item.targetList + ", roomSubList=" + props.roomSubList); + var switchedTarget = false; if (item.targetList !== props.roomSubList) { // we've switched target, so remove the tile from the previous target. // n.b. the previous target might actually be the source list. + console.log("switched target"); + switchedTarget = true; item.targetList.removeRoomTile(item.room); item.targetList = props.roomSubList; } @@ -130,12 +134,13 @@ var roomTileTarget = { props.roomSubList.moveRoomTile(item.room, roomTile.index); } } - else { + else if (switchedTarget) { if (!props.roomSubList.findRoomTile(item.room).room) { // add to the list in the right place props.roomSubList.moveRoomTile(item.room, 0); - props.roomSubList.sortList(); } + // we have to sort the list whatever to recalculate it + props.roomSubList.sortList(); } }, }; diff --git a/src/skins/vector/views/organisms/RoomList.js b/src/skins/vector/views/organisms/RoomList.js index 9c67d905f..8ee456e9b 100644 --- a/src/skins/vector/views/organisms/RoomList.js +++ b/src/skins/vector/views/organisms/RoomList.js @@ -65,6 +65,7 @@ module.exports = React.createClass({