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/client/notifications/UsersNameChanged.js

36 lines
586 B

import { Meteor } from 'meteor/meteor';
Meteor.startup(function() {
RocketChat.Notifications.onLogged('Users:NameChanged', function({ _id, name, username }) {
RocketChat.models.Messages.update({
'u._id': _id,
}, {
$set: {
'u.name': name,
},
}, {
multi: true,
});
RocketChat.models.Messages.update({
mentions: {
$elemMatch: { _id },
},
}, {
$set: {
'mentions.$.name': name,
},
}, {
multi: true,
});
RocketChat.models.Subscriptions.update({
name: username,
t: 'd',
}, {
$set: {
fname: name,
},
});
});
});