From 143f218e080158adf742f5e5aadbd4772987f789 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 26 Feb 2019 23:40:07 -0700 Subject: [PATCH] Make sure direct chat invites are treated as invites Fixes https://github.com/vector-im/riot-web/issues/8966 The DMRoomMap updates before we accept the invite, so make sure to check if it is an invite before checking if it is a direct chat. --- src/stores/RoomListStore.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index 082535543c..8f1f8523f7 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -292,11 +292,15 @@ class RoomListStore extends Store { // Stack the user's tags on top tags.push(...this._filterTags(room.tags)); + // Order matters here: The DMRoomMap updates before invites + // are accepted, so we check to see if the room is an invite + // first, then if it is a direct chat, and finally default + // to the "recents" list. const dmRoomMap = DMRoomMap.shared(); - if (dmRoomMap.getUserIdForRoomId(room.roomId)) { - tags.push("im.vector.fake.direct"); - } else if (myMembership === 'invite') { + if (myMembership === 'invite') { tags.push("im.vector.fake.invite"); + } else if (dmRoomMap.getUserIdForRoomId(room.roomId)) { + tags.push("im.vector.fake.direct"); } else if (tags.length === 0) { tags.push("im.vector.fake.recent"); }