notifications: fixes

This commit is contained in:
Matteo Pagliazzi
2018-02-04 13:28:05 +01:00
parent 2af99d7c65
commit 4efbbd7bac
15 changed files with 118 additions and 37 deletions

View File

@@ -1,4 +1,7 @@
import packageInfo from '../../../package.json';
import {
model as UserNotification,
} from '../models/userNotification';
module.exports = function responseHandler (req, res, next) {
// Only used for successful responses
@@ -13,7 +16,7 @@ module.exports = function responseHandler (req, res, next) {
if (message) response.message = message;
if (user) {
response.notifications = user.notifications.map(notification => notification.toJSON());
response.notifications = UserNotification.convertNotificationsToSafeJson(user.notifications);
response.userV = user._v;
}