Rocket.Chat
Rocket.Chat copied to clipboard
Extract default channel/group logic from setUsername
Use case: Automated anonymous user creation (e.g. import a LDAP user) could call the extracted function. Currently when we import a LDAP user, we can't call the setUsername method because it requires a logged in user. So, we have duplicate the logic to add them to "general" etc.
Another option would be to observe username field change and add user to default channel/group. Then the "bot" wouldn't have to add them to default channel/group.
This is done now. I have created a "setUsername" and also a "joinDefaultChannels" functions. Please check if that's enough.