Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Make sure direct chat invites are treated as invites
Browse files Browse the repository at this point in the history
Fixes element-hq/element-web#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.
  • Loading branch information
turt2live committed Feb 27, 2019
1 parent 426bdaf commit 143f218
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/stores/RoomListStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 143f218

Please sign in to comment.