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/server/startup/migrations/v051.js

24 lines
633 B

import { Migrations } from '../../../app/migrations';
import { Users, Rooms, Subscriptions } from '../../../app/models';
Migrations.add({
version: 51,
up() {
Rooms.find({ t: 'l', 'v.token': { $exists: true }, label: { $exists: false } }).forEach(function(room) {
const user = Users.findOne({ 'profile.token': room.v.token });
if (user) {
Rooms.update({ _id: room._id }, {
$set: {
label: user.name || user.username,
'v._id': user._id,
},
});
Subscriptions.update({ rid: room._id }, {
$set: {
name: user.name || user.username,
},
}, { multi: true });
}
});
},
});