mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
parent
5ba8959e83
commit
f5d65d7ac4
1 changed files with 8 additions and 5 deletions
|
@ -114,20 +114,23 @@ function ghostLocals(req, res, next) {
|
||||||
res.locals.csrfToken = req.csrfToken();
|
res.locals.csrfToken = req.csrfToken();
|
||||||
|
|
||||||
if (res.isAdmin) {
|
if (res.isAdmin) {
|
||||||
_.extend(res.locals, {
|
|
||||||
messages: ghost.notifications
|
|
||||||
});
|
|
||||||
|
|
||||||
api.users.read({id: req.session.user}).then(function (currentUser) {
|
api.users.read({id: req.session.user}).then(function (currentUser) {
|
||||||
_.extend(res.locals, {
|
_.extend(res.locals, {
|
||||||
currentUser: {
|
currentUser: {
|
||||||
name: currentUser.name,
|
name: currentUser.name,
|
||||||
email: currentUser.email,
|
email: currentUser.email,
|
||||||
image: currentUser.image
|
image: currentUser.image
|
||||||
}
|
},
|
||||||
|
messages: ghost.notifications
|
||||||
});
|
});
|
||||||
next();
|
next();
|
||||||
}).otherwise(function () {
|
}).otherwise(function () {
|
||||||
|
// Only show passive notifications
|
||||||
|
_.extend(res.locals, {
|
||||||
|
messages: _.reject(ghost.notifications, function (notification) {
|
||||||
|
return notification.status !== 'passive';
|
||||||
|
})
|
||||||
|
});
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue