Merge pull request #3840 from matrix-org/travis/ftue/user-lists/5.1-suggestions
Improve the quality of invite suggestions by filtering out DMspull/21833/head
commit
0529efc5cd
|
@ -332,6 +332,11 @@ export default class DMInviteDialog extends React.PureComponent {
|
||||||
|
|
||||||
// Generates { userId: {member, rooms[]} }
|
// Generates { userId: {member, rooms[]} }
|
||||||
const memberRooms = joinedRooms.reduce((members, room) => {
|
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));
|
const joinedMembers = room.getJoinedMembers().filter(u => !excludedUserIds.includes(u.userId));
|
||||||
for (const member of joinedMembers) {
|
for (const member of joinedMembers) {
|
||||||
if (!members[member.userId]) {
|
if (!members[member.userId]) {
|
||||||
|
@ -377,6 +382,7 @@ export default class DMInviteDialog extends React.PureComponent {
|
||||||
}
|
}
|
||||||
return b.score - a.score;
|
return b.score - a.score;
|
||||||
});
|
});
|
||||||
|
|
||||||
return members.map(m => ({userId: m.member.userId, user: m.member}));
|
return members.map(m => ({userId: m.member.userId, user: m.member}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue