-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: wrong pages number which includes private repository count. #844
Conversation
trusted LGTM |
models/repo.go
Outdated
return getPublicRepositoryCount(x, u) | ||
} | ||
|
||
// GetPrivateRepositoryCount returns the total number of public repositories of user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public -> private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Already has getPrivateRepositoryCount
private function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returns the total number of public repositories of user.
-> returns the total number of private repositories of user.
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ethantkoenig understood. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
models/repo_test.go
Outdated
func TestGetRepositoryCount(t *testing.T) { | ||
assert.NoError(t, PrepareTestDatabase()) | ||
|
||
count, _ := GetRepositoryCount(&User{ID: int64(10)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we assert that the returned error
is nil
, instead of just ignoring it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
models/repo_test.go
Outdated
func TestGetPublicRepositoryCount(t *testing.T) { | ||
assert.NoError(t, PrepareTestDatabase()) | ||
|
||
count, _ := GetPublicRepositoryCount(&User{ID: int64(10)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
models/repo_test.go
Outdated
func TestGetPrivateRepositoryCount(t *testing.T) { | ||
assert.NoError(t, PrepareTestDatabase()) | ||
|
||
count, _ := GetPrivateRepositoryCount(&User{ID: int64(10)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
routers/user/profile.go
Outdated
if showPrivate { | ||
total = ctxUser.NumRepos | ||
} else { | ||
count, _ := models.GetPublicRepositoryCount(ctxUser) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we check if the returned error
is nil
instead of ignoring it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
fix #843
GetPublicRepositoryCount
funcGetPrivateRepositoryCount
func