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
delete plainObj.filters;
if (originalDoc.notifications) {
plainObj.notifications = UserNotification.convertNotificationsToSafeJson(originalDoc.notifications);
}
return plainObj;
},

View file

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