-
Notifications
You must be signed in to change notification settings - Fork 132
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
Paginated users list in notifications and usergroups #477
Closed
indralukmana
wants to merge
34
commits into
Automattic:master
from
indralukmana:feature/paginated-users-list
Closed
Paginated users list in notifications and usergroups #477
indralukmana
wants to merge
34
commits into
Automattic:master
from
indralukmana:feature/paginated-users-list
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 lib for user list features. http://listjs.com/
add a jquery plugin for pagination. https://github.com/josecebe/twbs-pagination/
Turned off the users saved in user-groups. Making '$users' parameter in update_usergroup function default to null
In this commit the users list is redefined using list.js and twbsPagination. Mainly using DOM modification triggered by ajax calls.
The users list template should be able to be accessed in notifications and user-groups. In class-module this can be done.
put a check on the javascript so it only run on post creation/edit
put check on user-groups.js so the javascript only run on user-groups
Made a new separate function for adding and removing user to notification. Revert changes made to save_post_following_users() function to prevent breaking other codes.
Put a total user count in hidden field inside the users list template. This then can be used to initialize users list in notifications.php and user-groups.php. Eliminating the need to do ajax request to initialize the users list.
Split the counts logic to its own separate function for code clarity and performance. The ajax_retrieve_users() which called everytime users page repopulated now use get_users() which doesn't include total_count.
Split the logic for retrieving users count into its own ajax endpoint. The function ajax_retrieve_users_in_usergroups() now use get_users() which is more performant as it does note do total_count. So when doing search by keyword we only do total users calculation by keyword only once, in the beginning.
Add additional comments fro explaining functions
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.
This PR address the issue #450
The enhancement affects two modules: notifications and user-groups. In notifications, the users list is used to notify users on a post. In user-groups, the users list is used to modify usergroups membership.
I made/modify ajax endpoints in notifications.php and user-groups.php. The endpoints are mainly used to get users list in parts and to handle user saving.
Ajax endpoints:
The users list are created with a template users_list() in class_module.php. The DOM in the template then modified in notifications.js and user-groups.js. The ajax calls are also done in these two files.
Screenshots for the changes:
old notifications

new notifications

old usergroups

new usergroups
