Fix custom tags not being ordered manually

Actually fixes vector-im/riot-web#6135 unlike #1748, which
incorrectly assumed that custom tags would be included in
listOrders.

This fix makes sure that the `default` case in the `switch`
is actually used.
pull/21833/head
Luke Barnard 2018-02-14 11:23:29 +00:00
parent 7cc82a682c
commit 3020c8cd94
1 changed files with 18 additions and 24 deletions

View File

@ -160,22 +160,17 @@ class RoomListStore extends Store {
});
const listOrders = {
"manual": [
"m.favourite",
],
"recent": [
"im.vector.fake.invite",
"im.vector.fake.recent",
"im.vector.fake.direct",
"m.lowpriority",
"im.vector.fake.archived",
],
"m.favourite": "manual",
"im.vector.fake.invite": "recent",
"im.vector.fake.recent": "recent",
"im.vector.fake.direct": "recent",
"m.lowpriority": "recent",
"im.vector.fake.archived": "recent",
};
Object.keys(listOrders).forEach((order) => {
listOrders[order].forEach((listKey) => {
Object.keys(lists).forEach((listKey) => {
let comparator;
switch (order) {
switch (listOrders[listKey]) {
case "recent":
comparator = this._recentsComparator;
break;
@ -186,7 +181,6 @@ class RoomListStore extends Store {
}
lists[listKey].sort(comparator);
});
});
this._setState({
lists,