[FIX] LDAP login of new users overwriting `fname` from all subscriptions (#13203)

pull/13224/head
Diego Sampaio 7 years ago committed by GitHub
parent 852e8c7230
commit 06d07b8ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/rocketchat-lib/server/functions/setRealName.js

@ -18,7 +18,10 @@ RocketChat._setRealName = function(userId, name) {
RocketChat.models.Users.setName(user._id, name);
user.name = name;
RocketChat.models.Subscriptions.updateDirectFNameByName(user.username, name);
// if user has no username, there is no need to updated any direct messages (there is none)
if (user.username && user.username !== '') {
RocketChat.models.Subscriptions.updateDirectFNameByName(user.username, name);
}
if (RocketChat.settings.get('UI_Use_Real_Name') === true) {
RocketChat.Notifications.notifyLogged('Users:NameChanged', {

Loading…
Cancel
Save