From af1e3fc9c6eb974cd48146204c87fc8fe1e2a78c Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Tue, 6 Nov 2012 20:36:19 +0100 Subject: [PATCH] [#3009] Add c.new_activities to every page when logged in Not sure if this is the best way to do this --- ckan/lib/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ckan/lib/base.py b/ckan/lib/base.py index edc4264e2f1..904c61a00bd 100644 --- a/ckan/lib/base.py +++ b/ckan/lib/base.py @@ -214,6 +214,16 @@ def __before__(self, action, **params): self._identify_user() i18n.handle_request(request, c) + # If the user is logged in add their number of new activities to the + # template context. + if c.userobj: + from ckan.logic import get_action + new_activities_count = get_action( + 'dashboard_new_activities_count') + context = {'model': model, 'session': model.Session, + 'user': c.user or c.author} + c.new_activities = new_activities_count(context, {}) + def _identify_user(self): ''' Identifies the user using two methods: