Fix: pick last active DM for verification request

This commit is contained in:
Bruno Windels 2020-03-26 17:45:59 +01:00
parent 053a5a5ff4
commit e3e40ace81

View file

@ -174,6 +174,9 @@ export function findDMForUser(client, userId) {
return member && (member.membership === "invite" || member.membership === "join"); return member && (member.membership === "invite" || member.membership === "join");
} }
return false; return false;
}).sort((r1, r2) => {
return r2.getLastActiveTimestamp() -
r1.getLastActiveTimestamp();
}); });
if (suitableDMRooms.length) { if (suitableDMRooms.length) {
return suitableDMRooms[0]; return suitableDMRooms[0];