From f5d65d7ac4f6752445abfe086f49c9bdc5139608 Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Wed, 23 Oct 2013 21:01:31 +0000 Subject: [PATCH] Only show notifications when logged in. fixes #943 --- core/server.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/server.js b/core/server.js index fd8694c4d1..1c40354078 100644 --- a/core/server.js +++ b/core/server.js @@ -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 {