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/api/server/helpers/insertUserObject.ts

20 lines
459 B

import { Users } from '../../../models/server';
import { API } from '../api';
API.helperMethods.set(
'insertUserObject',
function _addUserToObject({ object, userId }: { object: { [key: string]: unknown }; userId: string }) {
// Maybe `object: { [key: string]: Meteor.User }`?
const user = Users.findOneById(userId);
if (user) {
object.user = {
_id: userId,
username: user.username,
name: user.name,
};
}
return object;
},
);