[ckan-changes] [okfn/ckan] 60d61d: [#3009] Fix dashboard activity stream auth

GitHub noreply at github.com
Mon Nov 19 15:54:47 UTC 2012


  Branch: refs/heads/2939-orgs
  Home:   https://github.com/okfn/ckan
  Commit: 60d61d894606345198989bfea20ecc347e116252
      https://github.com/okfn/ckan/commit/60d61d894606345198989bfea20ecc347e116252
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-05 (Mon, 05 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py
    M ckan/tests/functional/api/test_activity.py

  Log Message:
  -----------
  [#3009] Fix dashboard activity stream auth

This is necessary groundwork for implementing #3009 (new activity
notifications).

Make dashboard_activity_list() return the dashboard activity stream of
the logged in user, rather than accepting the user id as a param and
letting anyone (even not logged in users) view anyone else's private
activity streams!

Lots of fixing up of test_activity.py to take account of this:


  Commit: 2398b28ba8162a88f2301249a7c439f8883e1e16
      https://github.com/okfn/ckan/commit/2398b28ba8162a88f2301249a7c439f8883e1e16
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-06 (Tue, 06 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py
    M ckan/model/__init__.py
    A ckan/model/dashboard.py
    A ckan/tests/functional/api/test_dashboard.py

  Log Message:
  -----------
  [#3009] Initial implementation of activity streams on-site notification API


  Commit: af1e3fc9c6eb974cd48146204c87fc8fe1e2a78c
      https://github.com/okfn/ckan/commit/af1e3fc9c6eb974cd48146204c87fc8fe1e2a78c
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-06 (Tue, 06 Nov 2012)

  Changed paths:
    M ckan/lib/base.py

  Log Message:
  -----------
  [#3009] Add c.new_activities to every page when logged in

Not sure if this is the best way to do this


  Commit: 7202c928175f8eb8e2b046102cd302aab1bacdbe
      https://github.com/okfn/ckan/commit/7202c928175f8eb8e2b046102cd302aab1bacdbe
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-06 (Tue, 06 Nov 2012)

  Changed paths:
    A ckan/migration/versions/061_add_dashboard_table.py

  Log Message:
  -----------
  [#3009] Add dashboard table migration script


  Commit: a91b625202b4410b1237a4106cae382cc42af90d
      https://github.com/okfn/ckan/commit/a91b625202b4410b1237a4106cae382cc42af90d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-06 (Tue, 06 Nov 2012)

  Changed paths:
    M ckan/controllers/user.py

  Log Message:
  -----------
  [#3009] Mark activities as read on loading dashboard page


  Commit: f440d8d19a4bdbdd091c3a7b9ce96bcb65882800
      https://github.com/okfn/ckan/commit/f440d8d19a4bdbdd091c3a7b9ce96bcb65882800
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-07 (Wed, 07 Nov 2012)

  Changed paths:
    M ckan/public/base/less/masthead.less
    M ckan/templates/header.html

  Log Message:
  -----------
  Simple dashboard notifications style


  Commit: 0c9a31a51bdb6593f78f7c4bdc993544533b6a7d
      https://github.com/okfn/ckan/commit/0c9a31a51bdb6593f78f7c4bdc993544533b6a7d
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-07 (Wed, 07 Nov 2012)

  Changed paths:
    M ckan/public/base/javascript/resource.config

  Log Message:
  -----------
  Fixed broken removed resource


  Commit: 6c18d71e345b1ab33d6856770765d628d8daadb3
      https://github.com/okfn/ckan/commit/6c18d71e345b1ab33d6856770765d628d8daadb3
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-07 (Wed, 07 Nov 2012)

  Changed paths:
    M ckan/public/base/less/footer.less
    M ckan/public/base/less/masthead.less
    M ckan/templates/header.html

  Log Message:
  -----------
  Major header CSS re-write including a better notifications style


  Commit: 1b0d24c6352b46857c6f53b3e3350893ff38c82c
      https://github.com/okfn/ckan/commit/1b0d24c6352b46857c6f53b3e3350893ff38c82c
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-07 (Wed, 07 Nov 2012)

  Changed paths:
    M ckan/public/base/less/masthead.less
    M ckan/templates/header.html

  Log Message:
  -----------
  Final tweaks for notifications UI


  Commit: 819d192a6fabdb4463498b8ce8ecce4ef055c59b
      https://github.com/okfn/ckan/commit/819d192a6fabdb4463498b8ce8ecce4ef055c59b
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-08 (Thu, 08 Nov 2012)

  Changed paths:
    M ckan/controllers/user.py
    M ckan/lib/activity_streams.py
    M ckan/logic/action/get.py
    A ckan/public/base/javascript/modules/dashboard.js
    M ckan/public/base/javascript/resource.config
    M ckan/public/base/less/activity.less
    M ckan/public/base/less/ckan.less
    A ckan/public/base/less/dashboard.less
    M ckan/public/base/less/iehacks.less
    M ckan/templates/snippets/activity_item.html
    M ckan/templates/user/dashboard.html

  Log Message:
  -----------
  The dashboard now displays which items are actually new and which ones aren't now


  Commit: f6026f9c9d5c6d82e41aa58af71453b9df0cdf04
      https://github.com/okfn/ckan/commit/f6026f9c9d5c6d82e41aa58af71453b9df0cdf04
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/config/routing.py
    M ckan/controllers/group.py
    M ckan/lib/activity_streams.py
    M ckan/lib/dictization/model_dictize.py
    M ckan/lib/dictization/model_save.py
    M ckan/lib/helpers.py
    M ckan/logic/action/create.py
    M ckan/logic/action/delete.py
    M ckan/logic/action/get.py
    M ckan/logic/converters.py
    M ckan/logic/schema.py
    M ckan/logic/validators.py
    A ckan/migration/versions/061_add_follower__group_table.py
    M ckan/model/__init__.py
    M ckan/model/follower.py
    M ckan/public/base/javascript/modules/popover-context.js
    M ckan/public/base/less/activity.less
    M ckan/public/base/less/iehacks.less
    A ckan/templates/ajax_snippets/popover-context-group.html
    A ckan/templates/group/about.html
    M ckan/templates/group/activity_stream.html
    A ckan/templates/group/admins.html
    A ckan/templates/group/followers.html
    M ckan/templates/group/read.html
    M ckan/templates/user/read.html
    M ckan/tests/functional/api/test_follow.py
    M ckan/tests/functional/test_activity.py

  Log Message:
  -----------
  Merge master


  Commit: ac6d81fb37bae61911ecb839c9c46c42449dde18
      https://github.com/okfn/ckan/commit/ac6d81fb37bae61911ecb839c9c46c42449dde18
  Author: John Martin <me at johnmart.in>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/public/base/less/iehacks.less

  Log Message:
  -----------
  IE fixes for top account dropdown


  Commit: 7a353d0a3f1705c8c3a56d1da087f79eb4f48269
      https://github.com/okfn/ckan/commit/7a353d0a3f1705c8c3a56d1da087f79eb4f48269
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/config/routing.py
    M ckan/controllers/group.py
    M ckan/lib/activity_streams.py
    M ckan/lib/dictization/model_dictize.py
    M ckan/lib/dictization/model_save.py
    M ckan/lib/helpers.py
    M ckan/logic/action/create.py
    M ckan/logic/action/delete.py
    M ckan/logic/action/get.py
    M ckan/logic/converters.py
    M ckan/logic/schema.py
    M ckan/logic/validators.py
    A ckan/migration/versions/061_add_follower__group_table.py
    M ckan/model/__init__.py
    M ckan/model/follower.py
    M ckan/public/base/javascript/modules/popover-context.js
    M ckan/public/base/less/activity.less
    M ckan/public/base/less/iehacks.less
    A ckan/templates/ajax_snippets/popover-context-group.html
    A ckan/templates/group/about.html
    M ckan/templates/group/activity_stream.html
    A ckan/templates/group/admins.html
    A ckan/templates/group/followers.html
    M ckan/templates/group/read.html
    M ckan/templates/user/read.html
    M ckan/tests/functional/api/test_follow.py
    M ckan/tests/functional/test_activity.py

  Log Message:
  -----------
  Merge branch 'master' of github.com:okfn/ckan into 3009-on-site-notification-of-new-activity

Conflicts:
	ckan/public/base/less/iehacks.less


  Commit: 04d32acf204476709e0aeda9a19855ebb0c58e4d
      https://github.com/okfn/ckan/commit/04d32acf204476709e0aeda9a19855ebb0c58e4d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/public/base/less/iehacks.less

  Log Message:
  -----------
  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


  Commit: 367aee938d9efdd0841cfb903de0a3fb53525108
      https://github.com/okfn/ckan/commit/367aee938d9efdd0841cfb903de0a3fb53525108
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    R ckan/migration/versions/061_add_dashboard_table.py
    A ckan/migration/versions/062_add_dashboard_table.py

  Log Message:
  -----------
  [#3009] Rename migration script

Clashed with another branch


  Commit: cb3984e594768ecef113517a168b8b42f631df24
      https://github.com/okfn/ckan/commit/cb3984e594768ecef113517a168b8b42f631df24
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py
    M ckan/model/activity.py

  Log Message:
  -----------
  [#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.


  Commit: 73fe090f22e0414e987c229d8b4f5b95118fa60b
      https://github.com/okfn/ckan/commit/73fe090f22e0414e987c229d8b4f5b95118fa60b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py
    M ckan/logic/auth/get.py

  Log Message:
  -----------
  [#3009] Refactor dashboard_activity_list() auth

Add auth functions for dashboard_activity_list and
dashboard_new_activities_count.


  Commit: 1cb7b539fcbdfe53c153c97f651deef44b7395e9
      https://github.com/okfn/ckan/commit/1cb7b539fcbdfe53c153c97f651deef44b7395e9
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py

  Log Message:
  -----------
  [#3009] Don't notify a user about her own activities


  Commit: 8469a508a6add6a8bae578e273cdf64cef8b2fdf
      https://github.com/okfn/ckan/commit/8469a508a6add6a8bae578e273cdf64cef8b2fdf
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/logic/auth/get.py

  Log Message:
  -----------
  [#3009] Use is_authorized not check_access to wrap auth function

I think this is the right way to do it


  Commit: eb086d5da0ccbe7ea46b6f2bb70aafc0474dd748
      https://github.com/okfn/ckan/commit/eb086d5da0ccbe7ea46b6f2bb70aafc0474dd748
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/lib/activity_streams.py
    M ckan/logic/action/get.py

  Log Message:
  -----------
  [#3009] Don't mark the user's own activities as new on her dashboard


  Commit: fc626a5caf1d0ade528aae527f2efef7482aebca
      https://github.com/okfn/ckan/commit/fc626a5caf1d0ade528aae527f2efef7482aebca
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/logic/auth/publisher/get.py

  Log Message:
  -----------
  [#3009] Add new auth functions to publisher auth profile

This fixes a publisher auth test that was failing.


  Commit: 8ea022a01f5578ddbf418e9c10d7d03c5f57fc32
      https://github.com/okfn/ckan/commit/8ea022a01f5578ddbf418e9c10d7d03c5f57fc32
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-14 (Wed, 14 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/test_activity.py

  Log Message:
  -----------
  [#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.


  Commit: 2bfde7c1411e609c09e2443b9bd1439473f42900
      https://github.com/okfn/ckan/commit/2bfde7c1411e609c09e2443b9bd1439473f42900
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/test_dashboard.py

  Log Message:
  -----------
  [#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.


  Commit: 78cbd6228c41d7b7abe333bb9bcb511e310664fe
      https://github.com/okfn/ckan/commit/78cbd6228c41d7b7abe333bb9bcb511e310664fe
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/test_dashboard.py

  Log Message:
  -----------
  [#3009] Delete an unnecessary comment


  Commit: 79e28c0485b039831fa3812bea3637b272d6afbc
      https://github.com/okfn/ckan/commit/79e28c0485b039831fa3812bea3637b272d6afbc
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/lib/activity_streams.py

  Log Message:
  -----------
  [#3009] Delete an unnecessary line


  Commit: af925e247f8c224662f17202926541938e39031b
      https://github.com/okfn/ckan/commit/af925e247f8c224662f17202926541938e39031b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py

  Log Message:
  -----------
  [#3009] Delete an unused function


  Commit: aed806f72134f728af7eee468f695bc6f5fbcfd4
      https://github.com/okfn/ckan/commit/aed806f72134f728af7eee468f695bc6f5fbcfd4
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/controllers/user.py
    M ckan/logic/action/get.py
    M ckan/tests/functional/api/test_dashboard.py

  Log Message:
  -----------
  [#3009] Mark new activities terminology consistent

Always use new/old activities, don't mix in other terms like
read/unread, seen/unseen.


  Commit: 3007c853ae90b7317bff955cd5837d58d59cfded
      https://github.com/okfn/ckan/commit/3007c853ae90b7317bff955cd5837d58d59cfded
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/logic/action/get.py
    M ckan/logic/auth/get.py
    M ckan/logic/auth/publisher/get.py

  Log Message:
  -----------
  [#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.


  Commit: 11be4834e86228987b763249521c7e931dee2d4d
      https://github.com/okfn/ckan/commit/11be4834e86228987b763249521c7e931dee2d4d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M ckan/tests/functional/api/test_dashboard.py

  Log Message:
  -----------
  [#3009] Add max. num. new activities test


  Commit: 36c33efc2b6e8fab0ecf9326100d0fbe85a7086d
      https://github.com/okfn/ckan/commit/36c33efc2b6e8fab0ecf9326100d0fbe85a7086d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-11-15 (Thu, 15 Nov 2012)

  Changed paths:
    M doc/common-error-messages.rst

  Log Message:
  -----------
  Merge branch 'master' of github.com:okfn/ckan into 3009-on-site-notification-of-new-activity


  Commit: 326a7c02001d5f0871b9c578021056eff593d57f
      https://github.com/okfn/ckan/commit/326a7c02001d5f0871b9c578021056eff593d57f
  Author: tobes <toby.junk at gmail.com>
  Date:   2012-11-19 (Mon, 19 Nov 2012)

  Changed paths:
    M ckan/controllers/group.py
    M ckan/templates/user/dashboard.html

  Log Message:
  -----------
  Merge branch 'master' into 3009-on-site-notification-of-new-activity


  Commit: 391403305cf7d6417a0904605200508806cdf20e
      https://github.com/okfn/ckan/commit/391403305cf7d6417a0904605200508806cdf20e
  Author: tobes <toby.junk at gmail.com>
  Date:   2012-11-19 (Mon, 19 Nov 2012)

  Changed paths:
    M ckan/controllers/user.py
    M ckan/lib/activity_streams.py
    M ckan/lib/base.py
    M ckan/logic/action/get.py
    M ckan/logic/auth/get.py
    A ckan/migration/versions/062_add_dashboard_table.py
    R ckan/migration/versions/062_org_changes.py
    A ckan/migration/versions/063_org_changes.py
    M ckan/model/__init__.py
    M ckan/model/activity.py
    A ckan/model/dashboard.py
    A ckan/public/base/javascript/modules/dashboard.js
    M ckan/public/base/javascript/resource.config
    M ckan/public/base/less/activity.less
    M ckan/public/base/less/ckan.less
    A ckan/public/base/less/dashboard.less
    M ckan/public/base/less/footer.less
    M ckan/public/base/less/iehacks.less
    M ckan/public/base/less/masthead.less
    M ckan/templates/header.html
    M ckan/templates/snippets/activity_item.html
    M ckan/templates/user/dashboard.html
    M ckan/tests/functional/api/test_activity.py
    A ckan/tests/functional/api/test_dashboard.py

  Log Message:
  -----------
  Merge branch 'master' into 2939-orgs

Conflicts:
	ckan/logic/auth/get.py
	ckan/logic/auth/publisher/get.py
	ckan/templates/header.html
	ckan/tests/functional/api/test_activity.py

simple enough merge conflicts


Compare: https://github.com/okfn/ckan/compare/0635ad1bac0f...391403305cf7


More information about the ckan-changes mailing list