Always insert rooms into lists when they get lost

Room upgrades, direct chats, etc all end up being lost in these scenarios. Instead of losing them to the list, try and put them into a relevant spot of the list.

Fixes https://github.com/vector-im/riot-web/issues/9020
pull/21833/head
Travis Ralston 2019-03-01 15:48:10 -07:00 committed by David Baker
parent 1a7c313de7
commit a34f3780f3
1 changed files with 5 additions and 11 deletions

View File

@ -477,20 +477,14 @@ class RoomListStore extends Store {
room, category, this._state.lists[key], listsClone[key], lastTimestamp); room, category, this._state.lists[key], listsClone[key], lastTimestamp);
if (!pushedEntry) { if (!pushedEntry) {
// Special case invites: they don't really have timelines and can easily get lost when // There's some circumstances where the room doesn't fit anywhere, so just
// the user has multiple pending invites. Pushing them is the least worst option. // push the room in. We push it in at the start of the list because the room
if (listsClone[key].length === 0 || key === "im.vector.fake.invite") { // is probably important.
listsClone[key].push({room, category}); listsClone[key].splice(0, 0, {room, category});
insertedIntoTags.push(key);
} else {
// In theory, this should never happen
console.warn(`!! Room ${room.roomId} lost: No position available`);
} }
} else {
insertedIntoTags.push(key); insertedIntoTags.push(key);
} }
} }
}
// Double check that we inserted the room in the right places // Double check that we inserted the room in the right places
for (const targetTag of targetTags) { for (const targetTag of targetTags) {