Skip to content

Commit

Permalink
[#3009] Add c.new_activities to every page when logged in
Browse files Browse the repository at this point in the history
Not sure if this is the best way to do this
  • Loading branch information
Sean Hammond committed Nov 6, 2012
1 parent 2398b28 commit af1e3fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ckan/lib/base.py
Expand Up @@ -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:
Expand Down

0 comments on commit af1e3fc

Please sign in to comment.