Merge pull request #4286 from matrix-org/bwindels/picklastactivedmforverifreq

Fix: pick last active DM for verification request
pull/21833/head
Bruno Windels 2020-03-26 17:05:17 +00:00 committed by GitHub
commit 491dad3669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

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];