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/v243.ts

37 lines
923 B

import { addMigration } from '../../lib/migrations';
import { Users } from '../../../app/models/server';
import { Settings } from '../../../app/models/server/raw';
addMigration({
version: 243,
async up() {
const mobileNotificationsSetting = await Settings.findOneById('Accounts_Default_User_Preferences_mobileNotifications');
await Settings.removeById('Accounts_Default_User_Preferences_mobileNotifications');
if (mobileNotificationsSetting?.value) {
Settings.update(
{
_id: 'Accounts_Default_User_Preferences_pushNotifications',
},
{
$set: {
value: mobileNotificationsSetting.value,
},
},
{
upsert: true,
},
);
}
Users.update(
{ 'settings.preferences.mobileNotifications': { $exists: 1 } },
{
$rename: {
'settings.preferences.mobileNotifications': 'settings.preferences.pushNotifications',
},
},
{ multi: true },
);
},
});