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

36 lines
644 B

RocketChat.Migrations.add({
version: 133,
up() {
const subscriptions = RocketChat.models.Subscriptions.find({
t: 'd',
$or: [{
ts: { $gte: new Date('2018-07-09T00:00:00Z') },
}, {
ts: null,
}],
});
subscriptions.forEach((subscription) => {
if (subscription.name !== subscription.fname) {
return;
}
const user = RocketChat.models.Users.findOne({
username: subscription.name,
}, {
fields: {
name: 1,
},
});
if (!user) {
return;
}
RocketChat.models.Subscriptions.update({
_id: subscription._id,
}, {
$set: {
fname: user.name,
},
});
});
},
});