The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/ui-utils/client/lib/getUidDirectMessage.js

15 lines
400 B

import { Meteor } from 'meteor/meteor';
import { Rooms } from '../../../models/client';
export const getUidDirectMessage = (rid, userId = Meteor.userId()) => {
const room = Rooms.findOne({ _id: rid }, { fields: { uids: 1 } });
if (!room || !room.uids || room.uids.length > 2) {
return false;
}
const other = room && room.uids.filter((uid) => uid !== userId);
return other && other[0];
};