Keep direct rooms orthogonal (#183)
Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
@@ -72,7 +72,22 @@ function parseReply(rawBody) {
|
||||
};
|
||||
}
|
||||
|
||||
function hasDMWith(userId) {
|
||||
const mx = initMatrix.matrixClient;
|
||||
const directIds = [...initMatrix.roomList.directs];
|
||||
|
||||
return directIds.find((roomId) => {
|
||||
const dRoom = mx.getRoom(roomId);
|
||||
const roomMembers = dRoom.getMembers();
|
||||
if (roomMembers.length <= 2 && dRoom.getMember(userId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
getBaseUrl, getUsername, getUsernameOfRoomMember,
|
||||
isRoomAliasAvailable, getPowerLabel, parseReply,
|
||||
hasDMWith,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user