Skip to content
Snippets Groups Projects
Commit 40e6f9ee authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Fix error when activating new users

Closes #5949
parent 9a090d16
No related merge requests found
......@@ -17,10 +17,12 @@ Meteor.methods({
const user = RocketChat.models.Users.findOneById(userId);
if (user && user.username) {
if (user) {
RocketChat.models.Users.setUserActive(userId, active);
RocketChat.models.Subscriptions.setArchivedByUsername(user.username, !active);
if (user.username) {
RocketChat.models.Subscriptions.setArchivedByUsername(user.username, !active);
}
if (active === false) {
RocketChat.models.Users.unsetLoginTokens(userId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment