-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
API: support /users/:username/repos #1059
Conversation
routers/api/v1/api.go
Outdated
@@ -284,6 +285,9 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
Delete(user.DeletePublicKey) | |||
}) | |||
|
|||
m.Combo("/repos", reqToken()).Get(user.ListMyRepos). |
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.
reqToken()
isn't required here; it is already included on line 301.
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.
Got it, thanks.
One small tweak, otherwise LGTM |
routers/api/v1/user/repo.go
Outdated
|
||
import ( | ||
api "code.gitea.io/sdk/gitea" | ||
|
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.
remove empty line
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/api/v1/user/repo.go
Outdated
// listUserRepos - List the repositories owned by the given user. | ||
func listUserRepos(ctx *context.APIContext, u *models.User) { | ||
userID := u.ID | ||
showPrivateRepos := ctx.User.ID == userID && ctx.IsSigned |
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.
(ctx.User.ID == userID || ctx.User.IsAdmin) && ctx.IsSigned
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. Good catch.
LGTM |
clean up fix arguments remove repeated token give admins listing rights
LGTM |
Fix for half of: #494. I'm not 100% sure about the movement of functions and files and defer to you but I thought this grouping made sense.