mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Fix rooms disappearing that were created by the user
Fixes https://github.com/vector-im/riot-web/issues/14388 We were receiving a read receipt before a room object, leading to the algorithm to assume the room is archived (no membership), which was causing later index issues when the room tried to get moved from archived to untagged. To prevent this, we just ignore nonsensical updates.
This commit is contained in:
parent
cd0106964f
commit
00fc34924c
@ -41,6 +41,17 @@ import { getListAlgorithmInstance } from "./list-ordering";
|
||||
*/
|
||||
export const LIST_UPDATED_EVENT = "list_updated_event";
|
||||
|
||||
// These are the causes which require a room to be known in order for us to handle them. If
|
||||
// a cause in this list is raised and we don't know about the room, we don't handle the update.
|
||||
//
|
||||
// Note: these typically happen when a new room is coming in, such as the user creating or
|
||||
// joining the room. For these cases, we need to know about the room prior to handling it otherwise
|
||||
// we'll make bad assumptions.
|
||||
const CAUSES_REQUIRING_ROOM = [
|
||||
RoomUpdateCause.Timeline,
|
||||
RoomUpdateCause.ReadReceipt,
|
||||
];
|
||||
|
||||
interface IStickyRoom {
|
||||
room: Room;
|
||||
position: number;
|
||||
@ -755,6 +766,11 @@ export class Algorithm extends EventEmitter {
|
||||
}
|
||||
|
||||
if (!this.roomIdsToTags[room.roomId]) {
|
||||
if (CAUSES_REQUIRING_ROOM.includes(cause)) {
|
||||
console.warn(`Skipping tag update for ${room.roomId} because we don't know about the room`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Updating tags for room ${room.roomId} (${room.name})`);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user