Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Follow #6

Merged
merged 62 commits into from May 15, 2012
Merged

Feature: Follow #6

merged 62 commits into from May 15, 2012

Conversation

aron
Copy link
Contributor

@aron aron commented Apr 30, 2012

Pull request created for code review; if someone wants to update this with more appropriate info please do :)

Sean Hammond added 30 commits April 19, 2012 18:42
Add ckan/model/follower.py with follower_table definition.

Add follower_create logic action and auth functions.

Add default_create_follower_schema.

Add follower_list, user_follower_list and dataset_follower_list logic
action functions.

Add follower_table migration script.

Add incomplete tests in ckan/tests/functional/api/test_follow.py.
More work is needed to place them in a consistent location in the tab
bar (currently they look different on user pages than on dataset pages)
Only show the Follow button when viewing the page of another user and
not on your own page or the login or register pages
num_followers should probably be added to the package dict to avoid
having to add it to the template context in multiple places, but this'll
do for now.
..and also add follower_delete and make the Follow buttons turn into
Unfollow buttons when the user is following the object.

It now uses an ORM class Follower, where each follower has follower_id,
follower_type, object_id and object_type (got rid of the word 'followee'
because it was confusing, not that 'object' is very good either).

Got rid of user_follower_list, dataset_follower_list,
user_follower_count, dataset_follower_count, just have follower_list and
follower_count.

Don't bother letting people specify the follower when calling
follower_create or follower_delete just always use the authorized user.

Move some code from logic functions into follower model.
e.g. if you click on a Follow button then (after the ajax request
returns successfully) javascript turns the button into an Unfollow
button without refreshing the page. (Previously the button wouldn't
change to Unfollow until you refreshed the page.)
Conflicts:
	ckan/controllers/package.py
	ckan/templates/package/layout.html
Broke long test methods into lots of smaller ones, and also added in
some test conditions, including testing responses from am_following
Sean Hammond and others added 25 commits May 8, 2012 15:46
Conflicts:
	ckan/templates/package/layout.html
Move initialisation of a few more template variables into
_setup_template_variables(), and change read(), edit(), and followers()
to use it. This removes some code duplication and fixes issues with the
followers count and follow button not being initialisd on all user
controller pages.

Change new() to _not_ use _setup_template_variables() as it only needs
c.is_sysadmin and not the rest.

Also fix templates/user/layout.html so that the Followers tab appears on
both your own user page (when logged in) and on other user's pages.
Use HTML5 data- attributes
Now uses two many-many relationship tables UserFollowingUser and
UserFollowingDataset instead of one Follower table, so the user IDs and
dataset
IDs can now be foreign keys with on update cascade and on delete
cascade.

default_create_follower_schema() becomes default_follow_user_schema()
and
default_follow_dataset_schema().

follower_dictize() becomes user_following_user_dictize() and
user_following_dataset_dictize().

follower_dict_save() becomes user_following_user_dict_save() and
user_following_dataset_dict_save().

follower_create() becomes follow_user() and follow_dataset().

follower_delete() becomes unfollow_user() and unfollow_dataset().

follower_count() becomes user_follower_count() and
dataset_follower_count().

follower_list() becomes user_follower_list() and
dataset_follower_list().

am_following() becomes am_following_user() and am_following_dataset().

Removed the follower_create() and follower_delete() auth functions,
anyone can
follow or unfollow anything as long as they're logged in.

Follower specific validation functions aren't needed anymore.
Fix the missing related count on the following page for a given
dataset.
@seanh seanh merged commit 7d02ca9 into master May 15, 2012
pduchesne pushed a commit to pduchesne/ckan that referenced this pull request Jan 25, 2015
[ckan#1645] Regular harvests - copy form.html from master.
Zharktas pushed a commit that referenced this pull request Apr 20, 2021
Update kowhai/ckan with ckan/ckan (master)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants