Skip to content

Commit

Permalink
[#1519] Fix organization activity filter in dashboard
Browse files Browse the repository at this point in the history
The old implementation had the same type for orgs and groups and when an
org was selected a 404 was returned because group_show was called.

I didn't go all the way down separating both, ie group_followee list
still returns both groups and orgs.

Conflicts:
	ckan/logic/action/get.py
  • Loading branch information
amercader committed Jun 19, 2014
1 parent 549cf83 commit ed70771
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ckan/controllers/user.py
Expand Up @@ -570,7 +570,8 @@ def display_name(followee):
action_functions = {
'dataset': 'package_show',
'user': 'user_show',
'group': 'group_show'
'group': 'group_show',
'organization': 'organization_show',
}
action_function = logic.get_action(
action_functions.get(filter_type))
Expand Down
3 changes: 2 additions & 1 deletion ckan/lib/helpers.py
Expand Up @@ -1413,7 +1413,8 @@ def dashboard_activity_stream(user_id, filter_type=None, filter_id=None,
action_functions = {
'dataset': 'package_activity_list_html',
'user': 'user_activity_list_html',
'group': 'group_activity_list_html'
'group': 'group_activity_list_html',
'organization': 'organization_activity_list_html',
}
action_function = logic.get_action(action_functions.get(filter_type))
return action_function(context, {'id': filter_id, 'offset': offset})
Expand Down
9 changes: 6 additions & 3 deletions ckan/logic/action/get.py
Expand Up @@ -2695,9 +2695,12 @@ def display_name(followee):
dicts = followee_list_function(context, data_dict)
for d in dicts:
followee_dicts.append(
{'type': followee_type,
'display_name': display_name(d),
'dict': d})
# TODO: groups and orgs should probably have their own
# followee_list function
{'type': followee_type if followee_type != 'group'
else d.get('type'),
'display_name': display_name(d),
'dict': d})

followee_dicts.sort(key=lambda d: d['display_name'])

Expand Down
2 changes: 2 additions & 0 deletions ckan/templates/user/snippets/followee_dropdown.html
Expand Up @@ -5,6 +5,8 @@
<i class="icon-user"></i>
{% elif type == 'group' %}
<i class="icon-group"></i>
{% elif type == 'organization' %}
<i class="icon-building"></i>
{% endif %}
{%- endmacro %}

Expand Down

0 comments on commit ed70771

Please sign in to comment.