From b6ce1c88abf922236a5b209f177fa65e2a6d0c07 Mon Sep 17 00:00:00 2001 From: Nigel Babu Date: Wed, 3 Apr 2013 17:16:24 +0530 Subject: [PATCH] [#256] Remove id from dashboard activity list. * Remove id from the dashboard activity list functions * If offset is less than 30, show less should link to offset 0. --- ckan/controllers/user.py | 4 ++-- ckan/lib/helpers.py | 6 +++--- ckan/logic/action/get.py | 6 ++---- ckan/templates/activity_streams/activity_stream_items.html | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ckan/controllers/user.py b/ckan/controllers/user.py index 638bd7a7231..7a4ef42f7df 100644 --- a/ckan/controllers/user.py +++ b/ckan/controllers/user.py @@ -573,8 +573,8 @@ def dashboard(self, id=None, offset=0): context, {'id': c.userobj.id, 'q': q}) c.dashboard_activity_stream_context = self._get_dashboard_context( filter_type, filter_id, q) - c.dashboard_activity_stream = h.dashboard_activity_stream( - id, filter_type, filter_id, offset) + c.dashboard_activity_stream = h.dashboard_activity_stream(filter_type, + filter_id, offset) # Mark the user's new activities as old whenever they view their # dashboard page. diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index 48dab3d58ec..23440a47bf3 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -1282,9 +1282,9 @@ def user_in_org_or_group(group_id): return len(query.all()) != 0 -def dashboard_activity_stream(user_id, filter_type=None, filter_id=None, +def dashboard_activity_stream(filter_type=None, filter_id=None, offset=0): - '''Return the dashboard activity stream of the given user. + '''Return the dashboard activity stream of the current user. :param user_id: the id of the user :type user_id: string @@ -1312,7 +1312,7 @@ def dashboard_activity_stream(user_id, filter_type=None, filter_id=None, return action_function(context, {'id': filter_id, 'offset': offset}) else: return logic.get_action('dashboard_activity_list_html')( - context, {'id': user_id, 'offset': offset}) + context, {'offset': offset}) def recently_changed_packages_activity_stream(): diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 86bf98d8a0e..010c7535c3a 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -2645,12 +2645,10 @@ def dashboard_activity_list_html(context, data_dict): ''' activity_stream = dashboard_activity_list(context, data_dict) model = context['model'] - user_id = model.User.get(context['user']).id offset = int(data_dict.get('offset', 0)) extra_vars = { - 'controller': 'dashboard', - 'action': 'activity', - 'id': user_id, + 'controller': 'user', + 'action': 'dashboard', 'offset': offset, } return activity_streams.activity_list_to_html(context, activity_stream, diff --git a/ckan/templates/activity_streams/activity_stream_items.html b/ckan/templates/activity_streams/activity_stream_items.html index ff863425a5a..42e54acd2b4 100644 --- a/ckan/templates/activity_streams/activity_stream_items.html +++ b/ckan/templates/activity_streams/activity_stream_items.html @@ -4,7 +4,7 @@ {% if activities %}