From 9188183c9bc5e00d8bdfaa21415b34151fb82859 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 13 Jan 2020 21:04:13 -0700 Subject: [PATCH] Improve the quality of invite suggestions by filtering out DMs This helps the small rooms from being scored highly, bringing out users you've not seen in a long while. --- src/components/views/dialogs/DMInviteDialog.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/views/dialogs/DMInviteDialog.js b/src/components/views/dialogs/DMInviteDialog.js index 371768eb4e..1a6e387f46 100644 --- a/src/components/views/dialogs/DMInviteDialog.js +++ b/src/components/views/dialogs/DMInviteDialog.js @@ -332,6 +332,11 @@ export default class DMInviteDialog extends React.PureComponent { // Generates { userId: {member, rooms[]} } const memberRooms = joinedRooms.reduce((members, room) => { + // Filter out DMs (we'll handle these in the recents section) + if (!!DMRoomMap.shared().getUserIdForRoomId(room.roomId)) { + return members; // Do nothing + } + const joinedMembers = room.getJoinedMembers().filter(u => !excludedUserIds.includes(u.userId)); for (const member of joinedMembers) { if (!members[member.userId]) { @@ -377,6 +382,7 @@ export default class DMInviteDialog extends React.PureComponent { } return b.score - a.score; }); + return members.map(m => ({userId: m.member.userId, user: m.member})); }