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

41 lines
704 B

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