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/apps/meteor/app/lib/server/functions/joinDefaultChannels.ts

12 lines
407 B

import { Users } from '@rocket.chat/models';
import { addUserToDefaultChannels } from './addUserToDefaultChannels';
export const joinDefaultChannels = async (userId: string, silenced?: boolean): Promise<void> => {
const user = await Users.findOneById(userId);
if (!user) {
throw new Meteor.Error('error-invalid-user', 'Invalid user');
}
return addUserToDefaultChannels(user, Boolean(silenced));
};