Find DMs with pending third-paty invites (#10256)

This commit is contained in:
Michael Weimann 2023-03-02 09:44:12 +01:00 committed by GitHub
parent 10a765472b
commit ffa047be68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 5 deletions

View file

@ -38,7 +38,15 @@ function extractSuitableRoom(rooms: Room[], userId: string): Room | undefined {
(m) => !functionalUsers.includes(m.userId) && m.membership && isJoinedOrNearlyJoined(m.membership),
);
const otherMember = joinedMembers.find((m) => m.userId === userId);
return otherMember && joinedMembers.length === 2;
if (otherMember && joinedMembers.length === 2) {
return true;
}
const thirdPartyInvites = r.currentState.getStateEvents("m.room.third_party_invite") || [];
// match room with pending third-party invite
return joinedMembers.length === 1 && thirdPartyInvites.length === 1;
}
return false;
})