okfn / ckanext-pdeu

Custom CKAN Extension for PublicData.eu
9 stars 4 forks source link

Filtering of the activity stream on the dashboard #13

Closed seanh closed 11 years ago

seanh commented 12 years ago

The idea is that there will be filter buttons next to your activity stream letting you filter the stream to show only activities from your subscribed searches, only from your followed users, etc. John has a mockup.

seanh commented 12 years ago

I think this is low priority

seanh commented 11 years ago

Decision is to add a drop-down to the dashboard page containing a list of all the users, datasets and groups that you're following, and letting you filter the activity stream to show only activities "from" a given source by selecting it from this list.

When a given object is selected and the activity stream is showing only activities from that object, then a preview of that object (e.g. with its name) will be added to the top of the activity stream, and next to this preview will be an unfollow button.

See @johnmartin's mockup here: http://okfn.johnmart.in/prototypes/#?project=dashboard&view=index

We are only going to support simple filtering to show either all activities from everything (default) or only activities from a single object, no combining to show activities from a given set of objects, or from objects of a given type, etc.

The followed objects in the dropdown will be sorted alphabetically by name.

The dropdown will contain a search box for searching/filtering the list of followed objects.

Backend tasks:

"From" needs to be defined but I think basically all activities that appear in a given object's public activity stream are "from" that object. Another of putting it is, all activities that the object contributes to the user's dashboard activity stream, when the user follows the object. These two definitions are not necessarily the same, although I think with the current implementation of the dashboard activity stream they are. Either way, a given activity can be "from" more than one object.

@johnmartin's requested format for followee_list to return:

{
    // In alphabetical order
    "following": [
        {
            // The Type of the item e.g: user, group, dataset, etc.
            "type": "user",
            // String representation of the name / title object.
            // User: their name, group: group's name, etc.
            "display_name": "Someone's name",
            // This one isn't 100% needed... but it'd be awesome if we could
            // have the full dict of the object enclosed as well
            "dict": { ... }
        },
        ...
    ]
}
seanh commented 11 years ago

@johnmartin Handing this over to you.

I've implemented the backend on this branch: https://github.com/okfn/ckan/compare/3028-dashboard-activity-stream-filtering

The new /api/action/followee_list endpoint will return a list of everything a given user is following, optionally filtered by a query string. The params are id (the id or name of the user whose followed objects you want to list) and optionally q (the query string).

To get just the activities from a given dataset, user or group just use /api/action/package_activity_list, user_activity_list and group_activity_list respectively. The way it's implemented currently, the activities contributed to your dashboard activity stream when you follow a dataset, user or group are exactly those activities that appear in the user, dataset or group's public activity stream on its own page (in the future we may want to change that, and at that time we'll have to refactor things).

I haven't tested the new stuff properly yet but I don't think that should hold you back, I'll get on with the tests while you do the frontend.

johnmartin commented 11 years ago

@seanh Excellent, thanks. I'll be working on this today.

seanh commented 11 years ago

Pull request for this feature is here:

https://github.com/okfn/ckan/pull/205

Feature branch is currently deployed http://pdeu.staging.ckanhosted.com/

seanh commented 11 years ago

I'm going to close this issue, although the pull request against ckan is not merged yet, but it will be