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

16 lines
646 B

RocketChat.Migrations.add({
version: 60,
up() {
let subscriptions = RocketChat.models.Subscriptions.find({ $or: [ { name: { $exists: 0 } }, { name: { $not: { $type: 2 } } } ] }).fetch();
if (subscriptions && subscriptions.length > 0) {
RocketChat.models.Subscriptions.remove({ _id: { $in: _.pluck(subscriptions, '_id') } });
}
subscriptions = RocketChat.models.Subscriptions.find().forEach(function(subscription) {
const user = RocketChat.models.Users.findOne({ _id: subscription && subscription.u && subscription.u._id });
if (!user) {
RocketChat.models.Subscriptions.remove({ _id: subscription._id });
}
});
}
});