From 8f6c79866225e7a3c6d031dba6588b339e1384a5 Mon Sep 17 00:00:00 2001 From: murtaza98 Date: Thu, 7 Sep 2023 13:49:17 +0530 Subject: [PATCH] skip new user role setting for updates to role via admin panel --- apps/meteor/app/authentication/server/startup/index.js | 2 +- apps/meteor/app/lib/server/functions/saveUser.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/meteor/app/authentication/server/startup/index.js b/apps/meteor/app/authentication/server/startup/index.js index cc541554e814..240fb1e35189 100644 --- a/apps/meteor/app/authentication/server/startup/index.js +++ b/apps/meteor/app/authentication/server/startup/index.js @@ -285,7 +285,7 @@ const insertUserDocAsync = async function (options, user) { globalRoles = [...globalRoles]; - const roles = getNewUserRoles(globalRoles); + const roles = options.skipNewUserRolesSetting ? globalRoles : getNewUserRoles(globalRoles); if (!user.type) { user.type = 'user'; diff --git a/apps/meteor/app/lib/server/functions/saveUser.js b/apps/meteor/app/lib/server/functions/saveUser.js index 9530ee3b365e..c743b21e72df 100644 --- a/apps/meteor/app/lib/server/functions/saveUser.js +++ b/apps/meteor/app/lib/server/functions/saveUser.js @@ -280,6 +280,7 @@ const saveNewUser = async function (userData, sendPassword) { joinDefaultChannels: userData.joinDefaultChannels, isGuest, globalRoles: roles, + skipNewUserRolesSetting: true, }; if (userData.email) { createUser.email = userData.email;