Merge master
IE fixes for top account dropdown
Merge branch 'master' of github.com:okfn/ckan into 3009-on-site-notification-of-new-activity

Conflicts:
	ckan/public/base/less/iehacks.less
Merge branch '3009-on-site-notification-of-new-activity' of github.com:okfn/ckan into 3009-on-site-notification-of-new-activity

Conflicts:
	ckan/public/base/less/iehacks.less
[#3009] Rename migration script

Clashed with another branch
[#3009] Refactor activity streams SQLAlchemy queries

This is necessary so that we can get the number of new activities in the
user's dashboard activity stream, not counting activities from the user
herself.

Rewrite the activity streams queries in a building blocks fashion. For
example:

_user_activity_query(user_id)
Returns a query for all activities from or about a given user, used for
the user's public activity stream.

_activities_from_everything_followed_by_user_query(user_id)
Returns a query from all activities from everything the given user
follows.

_dashboard_activity_query(user_id)
Used for the user's dashboard, returns the union of
_user_activity_query(user_id) and
_activities_from_everything_followed_by_user_query(user_id).

Now we can call _dashboard_activity_query(user_id) to get the activities
for the user's dashboard, and we can call
_activities_from_everything_followed_by_user_query(user_id) to get the
number of new activities on the user's dashboard, not counting the
activities from the user herself.

Also move all the activity streams SQLAlchemy queries out of
logic/action/get.py (except for the group's activity stream which is
problematic) and into model/activity.py, because I want to encapsulate
SQLAlchemy in the model and avoid using it from the logic.

This also groups all the activity streams queries together in the code
and makes them easier to understand and build on.
[#3009] Refactor dashboard_activity_list() auth

Add auth functions for dashboard_activity_list and
dashboard_new_activities_count.
[#3009] Don't notify a user about her own activities
[#3009] Use is_authorized not check_access to wrap auth function

I think this is the right way to do it
[#3009] Don't mark the user's own activities as new on her dashboard
[#3009] Add new auth functions to publisher auth profile

This fixes a publisher auth test that was failing.
[#3009] Fix some broken activity streams tests

These were all broken by the addition of 'is_new' to activity stream
dicts in dashboard_activity_list.

I removed one broken test that didn't seem to be testing what it thought
it was testing.
[#3009] Better tests for on-site activity stream notifications API

Test both the dashboard_new_activities_count and the marking of new
activities with 'is_new': True in dashboard_activity_list, and test that
the user's own activities are not counted as new but activities from
things she follows are.
[#3009] Delete an unnecessary comment
[#3009] Delete an unnecessary line
[#3009] Delete an unused function
[#3009] Mark new activities terminology consistent

Always use new/old activities, don't mix in other terms like
read/unread, seen/unseen.
[#3009] Fix auth for dashboard_mark_all_new_activities_as_old

I think this is the correct way to do it, so that the auth function can
be overridden by IAuth plugins.
[#3009] Add max. num. new activities test
Merge branch 'master' of github.com:okfn/ckan into 3009-on-site-notification-of-new-activity