fix(profile): use affiliation=own to get user repos #281
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.
Problem
The number of repositories on your own profile page is the same as shown on github.com, which is
(user.public_repos + user.total_private_repos)
. However, when the button is clicked, the repository list actually shows all the repositories where you haveadmin
permission. The delta here as I observed, is the repositories in a private organization you are part of where you are also grantedadmin
permission to.Another minor issue is the current way of querying extra data then filter in client is inefficient compared to querying the exact data that the client actually wants:
git-point/src/user/user.action.js
Lines 132 to 136 in 809a809
Approach
This PR uses
affiliation=own
from https://developer.github.com/v3/repos/#parameters to get user repos, which provides the exact data needed here. The number of repositories returned in this PR matches the number on user's profile page, which is(user.public_repos + user.total_private_repos)
.