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/v077.js

25 lines
573 B

RocketChat.Migrations.add({
version: 77,
up() {
if (RocketChat && RocketChat.models && RocketChat.models.Rooms) {
RocketChat.models.Rooms.find({
t: 'l',
'v._id': { $exists: true },
'v.username': { $exists: false }
}, { fields: { 'v._id': 1 } }).forEach(function(room) {
const user = RocketChat.models.Users.findOne({ _id: room.v._id }, { username: 1 });
if (user && user.username) {
RocketChat.models.Rooms.update({
_id: room._id
}, {
$set: {
'v.username': user.username
}
});
}
});
}
}
});