Skip to content

Commit

Permalink
Fix self DM (#17239)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored Apr 9, 2020
1 parent 76a1160 commit b61ba90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/lib/server/functions/createDirectRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export const createDirectRoom = function(members, roomExtraData = {}, options =
const uids = members.map(({ _id }) => _id).sort();

// Deprecated: using users' _id to compose the room _id is deprecated
const room = uids.length <= 2
const room = uids.length === 2
? Rooms.findOneById(uids.join(''), { fields: { _id: 1 } })
: Rooms.findOneDirectRoomContainingAllUserIDs(uids, { fields: { _id: 1 } });

const isNewRoom = !room;

const rid = room?._id || Rooms.insert({
...uids.length <= 2 && { _id: uids.join('') }, // Deprecated: using users' _id to compose the room _id is deprecated
...uids.length === 2 && { _id: uids.join('') }, // Deprecated: using users' _id to compose the room _id is deprecated
t: 'd',
usernames,
usersCount: members.length,
Expand Down

0 comments on commit b61ba90

Please sign in to comment.