Merge branch 'release' into develop

This commit is contained in:
Matteo Pagliazzi 2018-02-04 14:21:35 +01:00
commit 553dc116c5
2 changed files with 5 additions and 1 deletions

View file

@ -18,7 +18,9 @@ schema.plugin(baseModel, {
plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs plainObj._tmp = originalDoc._tmp; // be sure to send down drop notifs
delete plainObj.filters; delete plainObj.filters;
plainObj.notifications = UserNotification.convertNotificationsToSafeJson(originalDoc.notifications); if (originalDoc.notifications) {
plainObj.notifications = UserNotification.convertNotificationsToSafeJson(originalDoc.notifications);
}
return plainObj; return plainObj;
}, },

View file

@ -71,6 +71,8 @@ export let schema = new Schema({
* is fixed * is fixed
*/ */
schema.statics.convertNotificationsToSafeJson = function convertNotificationsToSafeJson (notifications) { schema.statics.convertNotificationsToSafeJson = function convertNotificationsToSafeJson (notifications) {
if (!notifications) return notifications;
return notifications.filter(n => { return notifications.filter(n => {
// Exclude notifications with a nullish value // Exclude notifications with a nullish value
if (!n) return false; if (!n) return false;