0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Merge pull request #1254 from halfdan/943-login-notification

Only show notifications when logged in.
This commit is contained in:
Hannah Wolfe 2013-10-24 03:35:37 -07:00
commit 0ddd7e8dd1

View file

@ -114,20 +114,23 @@ function ghostLocals(req, res, next) {
res.locals.csrfToken = req.csrfToken();
if (res.isAdmin) {
_.extend(res.locals, {
messages: ghost.notifications
});
api.users.read({id: req.session.user}).then(function (currentUser) {
_.extend(res.locals, {
currentUser: {
name: currentUser.name,
email: currentUser.email,
image: currentUser.image
}
},
messages: ghost.notifications
});
next();
}).otherwise(function () {
// Only show passive notifications
_.extend(res.locals, {
messages: _.reject(ghost.notifications, function (notification) {
return notification.status !== 'passive';
})
});
next();
});
} else {