From b0d115a64ac35b2a87fdcc11c7d7eec4f4228836 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 1 Dec 2017 18:20:38 +0000 Subject: [PATCH] Implement renumeration of ordered tags upon collision I was being bitten by this enough for me to want to fix it. This implementation really ought to be improved such that it doesnt tend towards being broken the more it is used. --- src/components/structures/RoomSubList.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 9ad265dc..251c6522 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -360,7 +360,13 @@ var RoomSubList = React.createClass({ if (order === orderA || order === orderB) { console.error("Cannot describe new list position. This should be incredibly unlikely."); - // TODO: renumber the list + this.state.sortedList.forEach((room, index) => { + MatrixClientPeg.get().setRoomTag( + room.roomId, this.props.tagName, + {order: index / this.state.sortedList.length}, + ); + }); + return index / this.state.sortedList.length; } return order;