Keep direct rooms orthogonal (#183)
Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
parent
a9692f7db4
commit
c8ae428df8
3 changed files with 31 additions and 11 deletions
src/util
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue