fix invalid push devices

This commit is contained in:
Matteo Pagliazzi
2020-03-01 21:49:52 +01:00
parent 6deee0ffc8
commit 3f5ee32684
5 changed files with 89 additions and 10 deletions

View File

@@ -6,6 +6,9 @@ import * as Tasks from '../task';
import {
model as UserNotification,
} from '../userNotification';
import {
model as PushDevice,
} from '../pushDevice';
import { // eslint-disable-line import/no-cycle
userActivityWebhook,
} from '../../libs/webhook';
@@ -190,6 +193,11 @@ schema.post('init', function postInitUser () {
this.notifications = UserNotification.cleanupCorruptData(this.notifications);
}
// Make sure pushDevices are loaded
if (this.isDirectSelected('pushDevices')) {
this.pushDevices = PushDevice.cleanupCorruptData(this.pushDevices);
}
return true;
});