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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Conflicts: ckan/templates/user/layout.html
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.
It's in the Follow button 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.
…ollow e.g. if not logged in
…o follow e.g. if not logged in
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
Add user_id_or_name_exists() validator
…ate follower entries
Broke long test methods into lots of smaller ones, and also added in some test conditions, including testing responses from am_following
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.
Looks like a merge effect
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.
Conflicts: ckan/model/__init__.py
…to feature-2304-follow
Fix the missing related count on the following page for a given dataset.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request created for code review; if someone wants to update this with more appropriate info please do :)