diff --git a/src/createRoom.js b/src/createRoom.js index 45e849065d..66d4d1908e 100644 --- a/src/createRoom.js +++ b/src/createRoom.js @@ -174,6 +174,9 @@ export function findDMForUser(client, userId) { return member && (member.membership === "invite" || member.membership === "join"); } return false; + }).sort((r1, r2) => { + return r2.getLastActiveTimestamp() - + r1.getLastActiveTimestamp(); }); if (suitableDMRooms.length) { return suitableDMRooms[0];